views:

558

answers:

2

I'm trying to send emails from my server by a PHP script. I used to send it by a native php function mail and everything worked OK. Here's the code I used:

$to  = $sMail;<br>
$subject = $sSubject;<br>
$message = $sMessage;

$headers  = 'From: [email protected]' . "\r\n";<br>
$headers .= 'Reply-To: [email protected]' . "\r\n";<br>
$headers .= 'MIME-Version: 1.0' . "\r\n";<br>
$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";<br>


$bRes = mail($to, $subject, $message, $headers);

I then switched to PHPMailer, and wasn't able to send mail to Hotmail accounts (all the other still worked). Hotmail server reports the error: "550 SC-001 Mail rejected by Windows Live Hotmail for policy reasons."

This is the code I used for PHPMailer:

$mail = new PHPMailer();<br>
$mail->IsHTML(true);<br>
$mail->CharSet = 'UTF-8';<br>
$mail->From     = '[email protected]';<br>
$mail->FromName = 'domain.com';<br>
$mail->Subject  = $sSubject;;<br>
$mail->Body     = $sMessage;<br>
$mail->AltBody  = strip_tags($sMessage;);<br>
$mail->AddAddress($sMail);<br>
$mail->Send();<br>
$mail->ClearAddresses();<br>
$mail->ClearAttachments();

As the sending works with the native function, I'm sure my server is able to send mails to hotmail. There must be a property to set when using PHPMailer, but I can't seem to find the right one. Anyone knows something abouth this?

Thank you very much!

A: 

Try to delete line $mail->FromName = 'domain.com';

Dan
I tried that, but no change. If it helps, here's the message body that's included in the error response:
nikola
Return-Path: <[email protected]> Received: (qmail 28894 invoked by uid 33); 23 Jan 2010 15:15:21 -0600 To: [email protected] Subject: Subject Date: Sat, 23 Jan 2010 15:15:21 -0600 From: Root User <[email protected]> Message-ID: <[email protected]> X-Priority: 3 X-Mailer: PHPMailer (phpmailer.sourceforge.net) [version 2.0.0 rc3] MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="xxx" --xxx Content-Type: text/plain; charset = "UTF-8" Content-Transfer-Encoding: 8bit Body --xxx
nikola
A: 

add a reply to address and that will fix it

Gregg