5

I have tried to make an email service on my web site, but after I tried the code below, I find that my Hotmail account cannot receive the test email but others are fine (Gmail and Yahoo). I am using Godaddy hosting. Please help.

My code:

<?php
require 'PHPMailerAutoload.php';

$mail = new PHPMailer;

$mail->setFrom('example@example.com', 'example');
$mail->addAddress('myemailid@hotmail.com', 'myname');
$mail->Subject = 'PHPMailer mail() test';
$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
$mail->AltBody = 'This is a plain-text message body';

if (!$mail->send()) {
    echo "Mailer Error: " . $mail->ErrorInfo;
} else {
    echo "Message sent!";
}

?>
Pang
  • 9,564
  • 146
  • 81
  • 122
userzero
  • 109
  • 5
  • 16
  • How would we be able to troubleshoot this since we obviously don't have your go-daddy credentials? – StillLearnin Oct 14 '15 at 03:48
  • You're sending via `mail()` (PHPMailer's default), so the message will be sent by your local mail server, and the record of what happens to the message will be in your mail server logs. – Synchro Oct 14 '15 at 06:01

1 Answers1

4

I had the same issue in the past and the solution was to apply for ip Whitelisting. Here's the steps to do that.

  • Step 1

Browse to the Hotmail Postmaster website

  • Step 2

Click on the link for "Email I send is being blocked or junked by Hotmail." You'll be redirected to the Hotmail Live Troubleshooting page.

  • Step 3

Review the troubleshooting guide to diagnose a problem. Email from your IP address might be automatically identified as junk mail for a number of reasons. Dynamic IP addresses may have been used by other parties for spam, or the DNS entry for your domain might not show up as legitimate to Hotmail servers. Identify and address the issues causing your email to Hotmail users to be blocked as junk.

  • Step 4

Fill out an application to the Junk Mail Reporting Program . This will help Hotmail identify your mailing domain and add it to a whitelist.

Pedro Lobito
  • 94,083
  • 31
  • 258
  • 268
  • The JMRP is great once you get on it, however it took me two and a half years of applying every month to actually get on it, and the web UI is really poor - 8px white text on a white background doesn't help! – Synchro Oct 14 '15 at 05:59
  • 1
    You save my life. Thanks! – userzero Nov 09 '15 at 02:37