We are no longer receiving HTML based emails from one of our web servers (using a PHP script), is there a flag that has been set to not allow the HTML?

Posted on 2008-11-04
Last Modified: 2012-05-05
For a few weeks now we have been sending emails using a PHP script that are html based. The html is extremely simple and has been made even more simple in light of this problem. We have been using the attached script with no success.

The exact script was working for sometime, but is no longer working. The script works perfectly fine when being sent to other emails (other than our exchange accounts, ie, gmail and yahoo). Also, when the script is executed from a different web server, the emails come in, HTML based, perfectly fine.

We have Exchange Server 2003 running as our only email server for the company and we are using Trend Micro for our Anti Virus and email scanner software. No matter who receives the email with in the company, the html emails are displayed purely as text, as displayed in the code block.

Is there a setting in exchange that is now preventing the HTML from being translated? The emails look like this no matter where they are viewed from, ie, MS Outlook, OWA, or Windows Mobile phones.

I spoke with the server admins who are hosting the server, and they said they have not changed anything on the server that would prevent the HTML from being displayed.

Thanks a lot for any help.

// Test of HTML email for RMTA

$headers = "From:\r\n";

$headers .= "Content-type: text/html;\r\n";

$to = "";

$subject = "Test HTML  mail";

$message = "<html><head></head><body><b>Hello!</b><br><table border=\"1\" width=\"400\"><tr><td> This is a simple email message</td></tr></table></body></html>";


echo "Mail Sent - ". $to;


Email Messages look like:


Content-type: text/html;

Message-Id: <>

Date: Tue,  4 Nov 2008 10:28:48 -0700 (MST)


X-OriginalArrivalTime: 04 Nov 2008 20:16:41.0500 (UTC) FILETIME=[3FFAA5C0:01C93EBA]

<html><head></head><body><b>Hello!</b><br><table border="1" width="400"><tr><td> This is a simple email message</td></tr></table></body></html>

Open in new window

Question by:mcjim2k
    LVL 11

    Expert Comment

    First, given how finicky email clients and SMTP servers are, I would strongly suggest that you use a package to generate emails. I always use PEAR's Mail and Mail_mime packages.

    These packages have a large install base and have been thoroughly tested and debugged. Anyway, try using \n instead of \r\n, and remove the last \r\n altogether from the "content-type" header. That might help.

    Author Comment

    Thank you for the advice on the PEAR Package, I will look into that, except I know the script works on other servers, and has worked on the current server which makes me believe the exchange server has added the server's ip to some spam list.

    Something interesting that i just discovered, if i execute the exact script above, but take out any HTML tags, all of the message looks exactly like the one in the above code, just with out the HTML tags. So it's more than just the HTML not coming through, it's something with the headers being added to the message body rather than staying in the header.

    Just a little insight i've discovered. Not sure if that helps anyone.
    LVL 11

    Accepted Solution

    Spam filters also do not like much HTML-only message. Normally you should provide a plain text alternative. This means your message would have multipart MIME and so related headers/anchors...

    Anyway, the fact that the "Content-Type"line is separate doesn't bod well with correct headers format.

    Author Comment


    Thank you very much. I know you mentioned try removing the \r characters in the first post, sorry i missed it, but i removed all \r's in the script and the email worked perfectly; with and without any html.

    Thank you for your help.

    Author Closing Comment

    Thank you very much for your help.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    Email statistics and Mailbox database quotas You might have an interest in attaining information such as mailbox details, mailbox statistics and mailbox database details from Exchange server. At that point, knowing how to retrieve this information …
    Find out how to use dynamic social media in email signatures with this top 10 DOs & DON’Ts.
    In this Micro Video tutorial you will learn the basics about Database Availability Groups and How to configure one using a live Exchange Server Environment. The video tutorial explains the basics of the Exchange server Database Availability grou…
    The video tutorial explains the basics of the Exchange server Database Availability groups. The components of this video include: 1. Automatic Failover 2. Failover Clustering 3. Active Manager

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now