1

I created a html newsletter and I want to use php mail() function to send the newsletter to customers email address in the user database. Before doing it, I test serval address that include gmail, hotmail, AOL, and yahoo. The gmail and yahoo instantly receive the html format email and everything works well(style and image displayed as designed), however the hotmail and AOL are not receive anything. I test sending a simple text email using mail() to hotmail and AOL, after waiting for long time (one night), they are able to receive the text format email. So I don't know what is wrong with hotmail and AOL. Is anyone having the same issue and knowing how to fix it?

Here is my header setting

    $subject = 'News Letter';

    $headers = "From: sales@example.com\r\n";
    $headers .= "Reply-To: sales@example.com\r\n";
    $headers .= "Return-Path:sales@example.com\r\n";
    $headers .= "MIME-Version: 1.0\r\n";
    $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";


mail($email, $subject, $message, $headers); 
Dai Wang
  • 57
  • 1
  • 6

2 Answers2

0

Make sure your $message has proper html and also has the tags as well. You can try sending a real email message, some of the larger companies will block spam messages. If your message is just "test" or "testing" then you may never get it. You may also have issues with being blocked if you are sending from a shared hosting server or IP.

A sure fix is to setup an actual email account, and send mail through there using SMTP.

Here's an answer with SMTP using PHPMailer().

Sending email with PHP from an SMTP server

Community
  • 1
  • 1
stomo21
  • 270
  • 2
  • 5
  • Hi, Stomo21. mailing through host SMTP and PHPMailer class solve all the problem! Thank you very much!! – Dai Wang Apr 28 '14 at 22:43
0

Check if you have set-up SPF records for the domain that you use in From: header. As a spam protection, those services may check if your server is allowed to send e-mails for that domain (setting-up SPF records solved my problem of Google marking mail sent by my server as spam, AOL or Hotmail may be more restrictive..)

More info about SPF records can be found here: https://en.wikipedia.org/wiki/Sender_Policy_Framework

Also check out DKIM: https://en.wikipedia.org/wiki/DKIM which may also help in guaranteed e-mail delivery.

vitro
  • 792
  • 5
  • 20