Jump to content

mail() does not send to Hotmail


mohammedsk

Recommended Posts

I am trying to send email using PHP function mail($email, $title, $body).
It sends to Yahoo and Gmail, but not Hotmail.

It does not make sense to me.
Any help will be appreciated.

[code]
$header = "Return-Path: [email protected]\n";
$header .= "X-Sender: [email protected]\n";
$header .= "From: ME. <[email protected]>\n";
$header .= "X-Mailer:PHP 5.1\n";
$header .= "MIME-Version: 1.0\n";

ini_set(sendmail_form, "[email protected]");

if (mail("$username", "$title", "$body") == false)
        echo "Activation failed";
else
echo "Please check your email for confirmation";
[/code]


Link to comment
https://forums.phpfreaks.com/topic/20689-mail-does-not-send-to-hotmail/
Share on other sites

Hotmail does tend to move it to the junk folder, but below is a good set of headers that work well.

[code]<?php
  $from_name = "HuggieBear";
  $from_address = "[email protected]";
 
  $to_name = "mohammedsk";
  $to_address = "$to_name <[email protected]>";
 
  $subject = "Hotmail likes these headers";
  $message = "Give these a try and see if you have any luck";
 
  $headers .= "MIME-Version: 1.0\r\n";
  $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
  $headers .= "From: $from_name <$from_address>\r\n";
  $headers .= "Reply-To: $from_name <$from_address>\r\n";
  $headers .= "X-Priority: 1\r\n";
  $headers .= "X-MSMail-Priority: High\r\n";
  $headers .= "X-Mailer: My Test Mailer";

  $success = mail($to_address, $subject, $message, $headers);
  if ($success) {
  echo "The email to $to_name from $from_name was successfully sent";
}
else {
echo "An error occurred when sending the email to $to_name from $from_name";
}
?>[/code]

Regards
Huggie
lol your hosting service lied....

they do not have any ability to look at mail queues for Microsofts hotmail servers.... basically they didnt have an answer and wanted to dump your call

what they should be able to provide you with is a mail log that will show if the mail server you are using was able to succesfully send a message to the hotmail mail server.  if they can show you a log saying that the message was successfully sent to hotmail and the hotmail server acknoledged it got it, then you will need to contact MS Hotmail Support and have them run a message track and see where teh message went on their end.

Remember email does not have a garunteed delivery timeframe so it is possible for it to take over an hour to be sent...  just because its normally fast doesnt mean it always is

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.