Search code examples
phphtmlemailhtml-emailemail-headers

Some users see HTML in email body after server changes


Pair.net recently upgraded our PHP install and afterwards client started see HTML in email body where previously he had seen formatted email body.

I add myself as a CC and my Outlook shows me the formatted body but on the same email he sees code.

Anyone run into this before?

Any hints?

Code looks like:

$headers = "From: $name <$email>\r\n" . 
    "Reply-To: $email\r\n" .
    "X-Mailer: PHP/" . phpversion(). 
    'MIME-Version: 1.0' . "\r\n" .
    'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$msg = "<html><body><head><style type='text/css'>TD { font-family: Tahoma, Helvetica, sans-serif, Arial, Verdana; font-weight:bold; }</style></head>";
$msg .="<table width='98%' border='0' cellspacing='8'> etc etc etc

mail("$to, me@myoffice.com", $sub, $msg, $headers);

Actual email headers follow:

Delivered-To: xxx@xxx.com
Received: by 10.204.63.10 with SMTP id z10cs87437bkh;
        Wed, 8 Jun 2011 12:50:43 -0700 (PDT)
Received: by 10.216.230.105 with SMTP id i83mr5392587weq.43.1307562643519;
        Wed, 08 Jun 2011 12:50:43 -0700 (PDT)
Return-Path: <anonymous@tinco.pair.com>
Received: from tinco.pair.com (tinco.pair.com [209.68.1.91])
        by mx.google.com with SMTP id f69si2172888wes.55.2011.06.08.12.50.42;
        Wed, 08 Jun 2011 12:50:43 -0700 (PDT)
Received-SPF: pass (google.com: best guess record for domain of anonymous@tinco.pair.com designates 209.68.1.91 as permitted sender) client-ip=209.68.1.91;
Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of anonymous@tinco.pair.com designates 209.68.1.91 as permitted sender) smtp.mail=anonymous@tinco.pair.com
Received: (qmail 11613 invoked by uid 65534); 8 Jun 2011 19:50:41 -0000
Date: 8 Jun 2011 19:50:41 -0000
Message-ID: <20110608195041.11612.qmail@tinco.pair.com>
To: sales@yyy.com, xxx@xxx.com
Subject: WEBSITE BERG SELECTION FORM
From: David XXX <xxx@xxx.com>
Reply-To: xxx@xxx.com
X-Mailer: PHP/5.3.6MIME-Version: 1.0
Content-type: text/html; charset=iso-8859-1

Solution

  • I continue to think server upgrades and switch to qmail may have done this but issue is resolved by switching to SwiftMail.