Link to home
Start Free TrialLog in
Avatar of mcjim2k
mcjim2kFlag for United States of America

asked on

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.
<?php
// 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>";
mail($to,$subject,$message,$headers);
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

Avatar of jausions
jausions
Flag of United States of America image

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.
Avatar of mcjim2k

ASKER

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.
ASKER CERTIFIED SOLUTION
Avatar of jausions
jausions
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mcjim2k

ASKER

jausions,

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.
Avatar of mcjim2k

ASKER

Thank you very much for your help.