Jim Giner
2014-09-13 16:20:18 UTC
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?
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?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php