Jump to content


Photo

mail() does not send to Hotmail


  • Please log in to reply
6 replies to this topic

#1 mohammedsk

mohammedsk
  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 14 September 2006 - 04:18 AM

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.

$header = "Return-Path: me@example.net\n";
$header .= "X-Sender: me@example.net\n";
$header .= "From: ME. <me@example.net>\n";
$header .= "X-Mailer:PHP 5.1\n";
$header .= "MIME-Version: 1.0\n";

ini_set(sendmail_form, "me@example.net");

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




#2 Zane

Zane
  • Administrators
  • Advanced Member
  • 4,134 posts

Posted 14 September 2006 - 04:23 AM

Welll here
mail("$username", "$title", "$body")
you're aren't even passing your headers
and you don't need to double quote your variables

try this
mail($username, $title, $body, $headers)

btn_donate_SM.gif Want to thank me? Contribute to my PayPal piggy-bank
 

172938.png

#3 Destruction

Destruction
  • Members
  • PipPipPip
  • Advanced Member
  • 108 posts

Posted 14 September 2006 - 04:28 AM

Also make absolutely sure the junkmail filter isn't lovingly moving it to the wrong place just in case.

Dest

#4 HuggieBear

HuggieBear
  • Members
  • PipPipPip
  • Advanced Member
  • 1,899 posts
  • LocationEngland, UK

Posted 14 September 2006 - 08:18 AM

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

<?php
   $from_name = "HuggieBear";
   $from_address = "myemail@mydomain.co.uk";
   
   $to_name = "mohammedsk";
   $to_address = "$to_name <youremail@yourdomain.co.uk>";
   
   $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";
	}
?>

Regards
Huggie
Advice to MySQL users: Get phpMyAdmin and test your queries work there first, take half the hassle out of diagnosis, also check the reserved words list.

Links: PHP Docs :: RegEx's :: MySQL :: DevGuru :: w3schools

#5 karthikeyan_coder

karthikeyan_coder
  • Members
  • PipPipPip
  • Advanced Member
  • 201 posts

Posted 14 September 2006 - 07:52 PM

i hope above three solutions will fix your prob... if still having the prob them try to use smtp classes... and make sure about your spam filter in Hotmail...


www.karthi.us

#6 mohammedsk

mohammedsk
  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 15 September 2006 - 04:44 AM

I very much appreciate all your help.
Unfortunately, all that did not work. I called the hosting service and they told me that Hotmail is putting all the messages I sent in a queue, why? They do not know.

Thanks a lot for all,

#7 markbett

markbett
  • Members
  • PipPipPip
  • Advanced Member
  • 133 posts

Posted 15 September 2006 - 08:08 AM

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users