Jump to content


Photo

PHP mail error


  • Please log in to reply
3 replies to this topic

#1 tulleh

tulleh
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 16 April 2006 - 11:08 AM

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.

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

That's my main mail coding, if you need the entire script, just say so please. Thanks :)

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 16 April 2006 - 11:26 AM

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?
Legend has it that reading the manual never killed anyone.
My site

#3 tulleh

tulleh
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 16 April 2006 - 11:29 AM

[!--quoteo(post=365279:date=Apr 16 2006, 12:26 PM:name=AndyB)--][div class=\'quotetop\']QUOTE(AndyB @ Apr 16 2006, 12:26 PM) View Post[/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...

<?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;

?>

Here's the whole script.

#4 tulleh

tulleh
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 21 April 2006 - 11:37 PM

Any help at all? :(




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users