We built a site last year with a HTML email facility. It was working beautifully - pulled info out of a database and personlised the email. It has images etc etc and looks great.
I set up an facility so that I would receive a copy of these emails just to track its usage.
Here is the code that creates the email:
if (!mysql_query ($ins_str)) {
$success = false;
$msg = 'Problem saving records to the database';
} else {
$to = $Email;
$adminMail = "xxxx@xxxx.com.au";
$loanCalcMail = "xxxx@xxxxx.com.au";
$borrowid = str_pad(strval(mysql_insert_id()),6,"0", STR_PAD_LEFT);
$subject = "Pre-Approval Certificate #LC".$borrowid;
$adminSubject = "Another Pre-Approval Certificate #LC".$borrowid.", for ".$FirstName." ".$LastName."";
$headers = "From: loancalculator.com.au <xxxx@xxxx.com.au>\r\n";
$headers .= "Reply-To: xxxx.com.au <xxxx@xxxx.com.au>\r\n";
$headers .= "Return-Path: xxxx@xxxx.com.au\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$headers .= "X-Priority: 1\r\n"; //Message priority is set to HIGH
$headers .= "Organization: xxxx\r\n"; // Organisation
$message = "<body>";
$message .= "<html>
<head>
<title>Pre-Approval Certificate</title>
</head>
<body> ..... </body></html>
and the code that sends the email:
mail($to,$subject,$message,$headers) ) {
mail($adminMail,$adminSubject,$message,$headers); mail($loanCalcMail,$adminSubject,$message,$headers);
As of August last year I noticed that the emails I was getting simply put all the html code in the body of the email unformatted. This is the case for Outlook Express on PC and Entourage on Mac as well as Netscape on PC and Mac. The only application that appears to work is the default mail application on Mac!
As of this week the client has noticed the same thing - and obviously contacted me with his concerns. He is using the same hardware and software as he has in the past.
I think it has something to do with the MIME format in the header. (But I don't understand why its just decided to do weird things now).
Here is the header information as it is showing in the emails:
Return-Path: <xxxx@xxxx.com.au>
Delivered-To: 801-xxxx@xxxx.com.au
Received: (qmail 17563 invoked by uid 48); 16 Feb 2005 05:45:13 -0000
Date: 16 Feb 2005 05:45:13 -0000
Message-ID: <20050216054513.17562.qmail@chifley.ozhosts.net>
To: xxxx@xxxx.com.au
Subject: Another Certificate #LC000089, for xxxx
X-PHP-Script: www.xxxx.com.au/PHP/preapproval.php for 203.102.111.193
From: xxxx.com.au <xxxx@xxxx.com.au>
Reply-To: xxxx.com.au <xxxx@xxxx.com.au>
MIME-Version: 1.0
Content-Type: text/html; charset=ISO-8859-1
X-Priority: 1
(Note that everything after 'MIME-Version: 1.0' (in bold) is actually NOT appearing in the email header but in the BODY of the email).
Does anyone have any ideas?
Best Regards.