tags:

views:

33

answers:

2

Hello all,

I have written a code to send mail on yahoo or gmail.Mail is sending on gmail but i m not seeing any message in yahoo mail. And in gmail i m seeing all html content with message. here is my code...

            $headers = "From: \"".$from_name."\" <".$from_email.">\n";
    $headers .= "To: \"".$to_name."\" <".$to_email.">\n";
    $headers .= "Return-Path: <".$from_email.">\n";
    $headers .= "MIME-Version: 1.0\n";
    $headers .= "Content-Type: text/HTML; charset=ISO-8859-1\n"; 

                            // message
            $message = '
            <html>
            <head>
              <title>Registration</title>
            </head>
            <body>             
              <table><tr>
                  <td> <a href="#'> Click Here To Activate Your account</a>
                   Thanks To visit site.com 
                  </td>
                </tr>
              </table>
            </body>
            </html>';

             if(mail('', $subject, $message, $headers))
              echo "successfully register !! please check your mail and clik on confirmation link";
A: 
$to = $to_email;
    $headers = "From: \"".$from_name."\" <".$from_email.">\n";
    $headers .= "To: \"".$to_name."\" <".$to_email.">\n";
    $headers .= "Return-Path: <".$from_email.">\n";
    $headers .= "MIME-Version: 1.0\n";
    $headers .= "Content-Type: text/HTML; charset=ISO-8859-1\n";

$message = <<<EOD
<html>
            <head>
              <title>Registration</title>
            </head>
            <body>             
              <table><tr>
                  <td> <a href="#'> Click Here To Activate Your account</a>
                   Thanks To visit site.com 
                  </td>
                </tr>
              </table>
            </body>
            </html>
EOD;

 if(mail($to, $subject, $message, $headers))
              echo "successfully register !! please check your mail and clik on confirmation link";

try this instead of your message string

duckbox
A: 

You may want to use something like PHPMailer instead of trying to build a MIME message yourself. It hides all the ugly work of setting headers and whatnot, and all you do is provide the content.

And in any case, assuming you built the mail properly, have you checked your mail server's outgoing log to see if the message even try to reach Yahoo's mail exchanger? Just because the mail() function in PHP succeeded doesn't mean the email ever got out your front door. Yahoo may have rejected it due to a malformed or missing header.

Marc B