Jump to content

PHP mail error


Recommended Posts

Can someone help me check my mail function? It suddenly stopped working, it gives me a SENT page, but the e-mail is never received.

[code]mail($mailto, $subject, $messageproper, "From:" .  "$name <$email>\r\nReply-To: $name <$email>");[/code]

That's my main mail coding, if you need the entire script, just say so please. Thanks :)
Link to comment
Share on other sites

If it used to work perfectly and then stopped working AND you didn't make any changes to it, then possibly your host upgraded php to a version where register_globals is OFF and your code assumed it was ON. How are the variables retrieved by your script?
Link to comment
Share on other sites

[!--quoteo(post=365279:date=Apr 16 2006, 12:26 PM:name=AndyB)--][div class=\'quotetop\']QUOTE(AndyB @ Apr 16 2006, 12:26 PM) [snapback]365279[/snapback][/div][div class=\'quotemain\'][!--quotec--]
If it used to work perfectly and then stopped working AND you didn't make any changes to it, then possibly your host upgraded php to a version where register_globals is OFF and your code assumed it was ON. How are the variables retrieved by your script?
[/quote]

Well, I did make some changes to it. I just changed everything to an index.php?p= format, so I only needed one master page. Then when I found it wasn't working, I changed the contact page back, and it still isn't working.

I get my variables from a form, though...

[code]<?php
// $mailto - set to the email address you want the form
// sent to, eg
//$mailto        = "youremailaddress@example.com";

$mailto = 'info@biopanda-diagnostics.com';

// $subject - set to the Subject line of the email, eg
//$subject    = "Feedback Form";

$subject = "Biopanda Feedback";

// the pages to be displayed, eg
//$formurl        = "http://www.example.com/feedback.html";
//$errorurl        = "http://www.example.com/error.html";
//$thankyouurl    = "http://www.example.com/thankyou.html";

$formurl = "http://biopanda-diagnostics.com/index.php?p=contact";
$errorurl = "http://biopanda-diagnostics.com/index.php?p=formerror";
$error2url = "http://biopanda-diagnostics.com/index.php?p=emailerror";
$thankyouurl = "http://biopanda-diagnostics.com/index.php?p=formsuccess";

// -------------------- END OF CONFIGURABLE SECTION ---------------

$name = $_POST['name'];
$email = $_POST['email'];
$email2 = $_POST['email2'];
$comments = $_POST['comments'];
$organisation = $_POST['organisation'];
$phone = $_POST['phone'];
$http_referrer = getenv( "HTTP_REFERER" );

if (!isset($_POST['email'])) {
ob_start();
    header("Location: $formurl");
ob_end_flush();
    exit;
}
if (empty($name) || empty($email) || empty($comments) || empty($organisation) || empty($email2)) {
ob_start();
   header("Location: $errorurl");
ob_end_flush();
   exit;
}
if ($email != $email2) {
ob_start();
    header("Location: $error2url");
ob_end_flush();
    exit;
}
$name = strtok( $name, "\r\n" );
$email = strtok( $email, "\r\n" );
if (get_magic_quotes_gpc()) {
    $comments = stripslashes( $comments );
}

$messageproper =
    "This message was sent from:\n" .
    "$http_referrer \n" . "Organisation:" . "$organisation" .
    "\n" . "Phone number:"  . $phone .
    "\n------------------------- COMMENT -------------------------\n\n" .
    "$comments" .
    "\n\n------------------------------------------------------------\n";

mail($mailto, $subject, $messageproper, "From:" .  "$name <$email>\r\nReply-To: $name <$email>");
ob_start();
header("Location: $thankyouurl");
ob_end_flush();
exit;

?>[/code]

Here's the whole script.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.