Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

New Server - Mail() won't send HTML to internal addresses

Status
Not open for further replies.

Muppsy007

Programmer
Apr 4, 2003
98
NZ
Hi, I have several mail() scripts that have worked fine on our current host. One sends an email to the customer, the other to our admin.

Since moving to a new dedicated server (FreeBSD 4.8, PHP 4.3.2, Apache, Qmail) we are having the problem where any HTML email sent from the site, to an address on the same server, displays the html code only, rather than the laid out HTML info.

However, if we send the mail to an address external to our server, it seems to work fine.

I have tested this with several mail() functions, including a simple "Hello World" one, with the same effect.

After playing around, I found that if I comment out the header entry "MIME-Version: 1.0\r\n" and make sure that "Content-type: text/html; charset=iso-8859-1\r\n" is appended to the header variable LAST, it works. If this line is not last, all other header entries are displayed in the email content, rather than in the header.

Has anyone seen this before? Surely it is a problem between PHP and Qmail?

One of the scripts is so complex, I can't get away with commenting out the line as stated above. (It's not my design and uses some sort of content checking) so I'm hoping to find an answer to this somewhere.

PS. Our host has been looking into it also, but cannot explain it.

Thanks
Aaron
 
It may be the filter on the receveing server....they are getting very finicky in the effort to reduce spam...malformed and incomplete headers are causing problems like this

Bastien

Cat, the other other white meat
 
Hi Bastien. I know it has nothing to do with mail filters as the same script works just from the original server just fine. But when setup on the new server (with no changes), the email simply displays all the HTML code on the page (even to the same email addresses that worked when sent from the orignal server)

Also, even If I put a very simple HTML mail script up on the new server, it still does the same thing.

Worth noting is that it works when I view the email in Hotmail, but nothing else seems to have worked yet. I have even sent a test message to my website in NZ, which I access via neomail, but it does the same thing (displays the html code) except in this case, the formatted html message is an attachment. (doesn't do that with OE/Outlook)

It must be the server, Qmail, PHP or Sendmail.

I cannot find a single thing on this, and my host is as baffled as I am. I hope someone has seen this before. I would hate to have to change hosts just because of this.

Cheers
Aaron
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top