PHP mail() function

Hi All,

Can anyone see an issue with the code below that would cause a blank email to show in yahoo mail?

My home account receives the message with no problem as well as msn mail and hot-mail, but for some reason yahoo mail receives the message, but it comes through blank.

I’ve tried adding extra headers but have now come stuck.

Yahoo mail have ubdated their email system so could it just be something to do with that?

Any help would be grateful

[php]

$to = $email;
$subject = ‘Your Voucher Code’;
$random_hash = md5(date(‘r’, time()));
$headers = “From: [email protected]”;
$headers .= “\r\nReply-To: [email protected]”;
$headers .= “\r\nReturn-Path: [email protected]”;
$headers .= “\r\nMessage-ID:<”.$now." TheSystem@".$_SERVER[‘SERVER_NAME’].">";
$headers .= “\r\nX-Mailer: PHP v”.phpversion();
$headers .= “\r\nMIME-Version: 1.0”;
$headers .= “\r\nContent-Type: multipart/alternative; boundary=“PHP-alt-”.$random_hash.”"";

ob_start();
?>
–PHP-alt-<?php echo $random_hash; ?>
Content-Type: text/plain; charset=“UTF-8”
Content-Transfer-Encoding: quoted-printable

Hello World!!!

This is simple test text email message.

–PHP-alt-<?php echo $random_hash; ?>
Content-Type: text/html; charset=“UTF-8”
Content-Transfer-Encoding: quoted-printable

Hello World!

This is something with HTML formatting.

Voucher code: <?php echo $code; ?>

<?php //copy current buffer contents into $message variable and delete current output buffer $message = ob_get_clean(); //send the email $mail_sent = @mail( $to, $subject, $message, $headers ); echo $mail_sent ? "Mail sent" : "Mail failed"; ?>

[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service