1

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: user@domain.com' . "\r\n";<br>
$headers .= 'Reply-To: user@domain.com' . "\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     = 'user@domain.com';<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!

Itay Moav -Malimovka
  • 52,579
  • 61
  • 190
  • 278
nikola
  • 11
  • 1
  • 2

1 Answers1

1

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

Dan
  • 55,715
  • 40
  • 116
  • 154
  • I tried that, but no change. If it helps, here's the message body that's included in the error response: – nikola Jan 23 '10 at 23:33
  • Return-Path: Received: (qmail 28894 invoked by uid 33); 23 Jan 2010 15:15:21 -0600 To: xxx@hotmail.com Subject: Subject Date: Sat, 23 Jan 2010 15:15:21 -0600 From: Root User Message-ID: <---@xxxxxx.xxx> 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 Jan 23 '10 at 23:35