E-mails not sent to hotmail .. Only Gmail & Yahoo accept

the mail() function

Moderators: macek, egami, gesf

User avatar
New php-forum User
New php-forum User
Posts: 70
Joined: Mon Jun 13, 2005 2:03 am
Location: Bahrain

E-mails not sent to hotmail .. Only Gmail & Yahoo accept

Postby ameenov » Sun May 07, 2006 7:57 am

I made a code to script called (Tell a friend).

It is sending emails perfectly but I noticed that it is not sending to hotmail at all .. every time i check my hotmail inbox and junk mail i don't see the e-mails is sent. But gmail and yahoo I always see it in the inbox.

My code

Code: Select all

if (isset($_POST['Submit']) || isset($_POST['name']) || isset($_POST['email']) || isset($_POST['to_email'])) {
$_SESSION['name_contact']=$_POST['name']; // set sessins for the name
$_SESSION['email_contact']=$_POST['email']; // set sessins for the your email
$_SESSION['to_email_tell']=$_POST['to_email']; // set sessins for your friend's email
if ($_POST['name'] =='') {
echo "please write your name";
elseif ($_POST['email'] =='') {
echo "please write your email";
elseif ($_POST['to_email'] =='') {
echo "Please write your friend email";
else {
$to_friend = htmlentities(stripslashes(strip_tags($_POST['to_email'])));

/* subject */
$subject = "Invitation to a site";
/* Text */
$body = "the email text here";

/* To send HTML mail, you can set the Content-type header. */
/* additional headers */
   $headers .= "X-Sender:  {$_POST['name']} <{$_POST['email']}>\n"; //
   $headers .="From: {$_POST['name']} <{$_POST['email']}>\n";
   $headers .= "Reply-To: {$_POST['name']} <{$_POST['email']}>\n";
   $headers .= "Date: ".date("r")."\n";
   $headers .= "Message-ID: <".date("YmdHis")."b99ja@".$_SERVER['SERVER_NAME'].">\n";
   $headers .= "Subject: $subject\n"; // subject write here
   $headers .= "Return-Path: {$_POST['name']} <{$_POST['email']}>\n";
   $headers .= "Delivered-to: {$_POST['name']} <{$_POST['email']}>\n";
   $headers .= "MIME-Version: 1.0\n";
   $headers .= "Content-type: text/html;charset=windows-1256\n";
   $headers .= "X-Priority: 1\n";
   $headers .= "Importance: High\n";
   $headers .= "X-MSMail-Priority: High\n";
   $headers .= "X-Mailer: b99ja Mailler With PHP!\n";

if (mail("$to_friend", $subject, "$body", $headers)) {
echo "Your mail sent";
} else {echo "Your mail did not sent";} // END if not send show this message
} // END ELSE conditioning
} // END isset conditioning

I don't know if it is from my coding or from hotmail
Last edited by ameenov on Mon May 08, 2006 2:19 am, edited 3 times in total.

New php-forum User
New php-forum User
Posts: 243
Joined: Wed Feb 01, 2006 9:18 am
Location: Netherlands

Postby Coditor » Mon May 08, 2006 12:06 am

There's a good chance a spamfilter is blocking the email.

Things like high-priority headers are counted as "possible spam" tags. If an email contains too many "possible spam" tags and/or keywords, it may be blocked. A different level may have been set for sending the mail to the junk folder than for actually deleting the email.

The subject also suggests spam, as does the length of the body. Try a different subject line and add some more content to the body. Then try again.

You might try to ask Hotmail why your email is blocked (send them a sample) but I doubt they will assist you because it breaks the point of having a spamfilter.


User avatar
Posts: 1717
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden

Postby gesf » Tue May 09, 2006 1:27 am

Also make sure your sending to the right email address. Make it all once... use CC "field".

User avatar
New php-forum User
New php-forum User
Posts: 70
Joined: Mon Jun 13, 2005 2:03 am
Location: Bahrain

Postby ameenov » Tue May 09, 2006 10:05 pm

Thanks for your replies but i tried your solutions but no chance to get it work :( ..
Now i searching for a code that sends emails to hotmail in anyway even if i get it going to the junk mail

New php-forum User
New php-forum User
Posts: 2
Joined: Sat Jun 17, 2006 11:46 am

Postby s1tufata » Sat Jun 17, 2006 12:00 pm


That is because you can't send HTML only messages. Real mail clients
always compose HTML messages with an alternative text part. When Hotmail
gets an HTML message that does not have a text part, it assumes
correctly that you are not using a real client, so the chances that the
message is SPAM are great.

You need to use MIME multipart alternative messages with the text and
HTML parts in the same body so the messages are sent like with normal
user mail clients.

If you do not know how to do this, you may want to try this popular MIME
message composing and sending class that follows the necessary standard
requirements to minimize the chances that your messages are confused
with SPAM.

You may get solution.:)

Return to “PHP coding => Mail”

Who is online

Users browsing this forum: No registered users and 1 guest