Re: mail() doesn't work

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At 12:20 PM 9/13/2014, 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");

Your web host support people need to look at the mail program's log files to see why the mail isn't being delivered. Since the mail() function returned "TRUE" this means that the mail as successfully sent to the system to be delivered.

Do you have shell access to your host?

If so, you can try something like this: (the "$" is the system prompt, not part of the command)

$ mail -vvv -s "test mail" to_address_goes_here < /dev/null

This should send a blank email message to the to_address_goes_here address.
The -vvv tells the mail program to be very verbose about writing out debug messages. These messages might help determining the problem.

Ken

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux