Forum Moderators: coopster

Message Too Old, No Replies

PHP mail problem

php script sending to Yahoo Mail

         

poodwaddle

2:56 pm on Oct 12, 2007 (gmt 0)

10+ Year Member



I have created a php script to send HTML mail. However, there's some glitch because it is failing. It sends to email within my site, but fails to send to my Yahoo mail. I have omitted much of the HTML formatting for simplicity. I am fairly new to PHP. Where's my glitch?

<?php

$sendTo = $_POST["toemail"];
$subject = $_POST["subject"];
$message = $_POST["message"];
$from = $_POST["name"];
$fromemail = $_POST["email"];

$html = '<html><body>' . $message . '</body></html>';

mail($sendTo,
$subject,
$html,
'To: Friend <' . $seldTo . ">\n" .
'From: ' . $from . '<' . $fromemail .">\n" .
"MIME-Version: 1.0\n" .
"Content-type: text/html; charset=iso-8859-1");

?>

dreamcatcher

3:28 pm on Oct 12, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Is Yahoo filtering it as spam?

dc

poodwaddle

3:46 pm on Oct 12, 2007 (gmt 0)

10+ Year Member



Good question.
How would I be able to test this?

eelixduppy

4:10 pm on Oct 12, 2007 (gmt 0)



>> How would I be able to test this?

Check your spam folder.

poodwaddle

6:04 pm on Oct 12, 2007 (gmt 0)

10+ Year Member



Doesn't appear to be a problem with the spam filter. The message does not appear in the Spam/Bulk mail folder. Somewhere between my php and Yahoo email the file is vanishing. I tried hardcoding a basic email php file similar to this:

<?php
$to = "myaddress@yahoo.com";
$subject = "test";
$body = testing testing 123";
if (mail($to, $subject, $body)) {
echo("<p>Message successfully sent!</p>");
} else {
echo("<p>Message delivery failed...</p>");
}
?>

This also fails, though it report success. I set up another email address at another site and it receives mail ok, but not yahoo. I was curious if maybe Yahoo requires some other parameters or if maybe my host has some problem I need to address.

limoshawn

1:29 am on Oct 14, 2007 (gmt 0)

10+ Year Member



$sendTo = $_POST["toemail"];

'To: Friend <' . $seldTo . ">\n" .

$sendTo

$seldTo

Don't know if your typing or cut-n-pasting, but in your example you have a typo in you send to variable.

barns101

12:47 pm on Oct 14, 2007 (gmt 0)

10+ Year Member



Doesn't appear to be a problem with the spam filter. The message does not appear in the Spam/Bulk mail folder.

I've had the same problem sending to Hotmail. In the end I found out that if your web host doesn't have valid PTR records Hotmail can fail to deliver the email to your mailbox without even putting it in the junk email folder. Perhaps Yahoo behaves in the same way?