• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 198
  • Last Modified:

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?

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: NoReply@mywebsite.org\r\n";
$headers .= "Content-type: text/html;\r\n";
$to = "email@domain.com";
$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: <20081104172848.00A000A00@mywebsite.org>
Date: Tue,  4 Nov 2008 10:28:48 -0700 (MST)
Return-Path: wwwrun@mywebsite.org
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

  • 3
  • 2
1 Solution
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. http://pear.php.net/package/Mail

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.
mcjim2kAuthor Commented:
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.
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.
mcjim2kAuthor Commented:

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.
mcjim2kAuthor Commented:
Thank you very much for your help.

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now