phpmailer with hotmail?

Posted by nikola on Stack Overflow See other posts from Stack Overflow or by nikola
Published on 2010-01-23T20:50:51Z Indexed on 2010/03/20 3:51 UTC
Read the original article Hit count: 666

Filed under:
|
|

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!

© Stack Overflow or respective owner

Related posts about phpmailer

Related posts about hotmail