On 14-09-13 12:20 PM, Jim Giner wrote:
ok - here's the scenario. Wrote a script that has been copied several times with success that traps an email, grabs some input and then sends me an email. Last week I attempted to make yet another copy of it to capture a new email address and do the same kind of thing. Should have been easy, but it's a nightmare. Let me say that my other instances of this template still work just fine. It's just this one that doesn't and I'm out of ideas. The same email call is being used across the board. Here's the code: $headers[] = "From: $incoming_email"; $headers[] = "Reply-To: $reply_to"; $headers[] = "X-Mailer: PHP/" . phpversion(); $header_str = implode("\r\n", $headers); $ans_msg = wordwrap($ans_msg, 70, "\r\n"); if (mail($to, $subject, $ans_msg, $header_str)) PostErrorLog("Email sent to $to",$done); else PostErrorLog("Email failed"); The function posterrorlog makes a call to error_log to output some messages since the email is not being sent. The call to mail() actually returns true yet it never delivers the message. The $to address is the same one I use in all of my versions of this script. The fact that my error log contains messages from the script proves that the call actually gets executed, yet no mail. The mailbox shows nothing on my host's webmail interface either. It's like the mail goes to thin air. I have tried it with a simple body of a dummy string value but that didn't help. The $incoming_email value is the mailbox that I am capturing mail from and is valid since that is how this script gets triggered (via a pipe from the email). So - any really really smart readers out there have any idea why one script using the same email code won't work?
Hi Jim, the mail() function returns true if the message is "accepted for delivery" and doesn't provide any information about whether it actually gets sent out. If you are receiving a return status code of true, then the mail server accepted it. So if you aren't receiving it on the other end then I would investigate the mail server logs.
You've said the script works in other places, are these on the same server where you are having problems? Is the target mail server the same in all cases?
Cheers, Rob. -- Phone: 613-822-9060 +++ Cell: 613-600-2836 E-Mail Disclaimer: Information contained in this message and any attached documents is considered confidential and legally protected. This message is intended solely for the addressee(s). Disclosure, copying, and distribution are prohibited unless authorized. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php