cdp103188
07-01-2008, 11:20 AM
I have been sending HTML emails via HTML forms on my website for a while now using the following method.
$base64contents = rtrim(chunk_split(base64_encode($message)));
But, all of a sudden it quit working. Now instead of seeing my nice HTML tables and stuff, I just see a bunch of base64 nonsense.
I am using Mozilla Thunderbird to receive emails, and I set it to where I can see all of the headers for the email, and on the old emails it shows this as a header:
Content-Transfer-Encoding: base64
but on the new emails (that don't load correctly) that header is missing, and instead it appears in the body of the email just before the un-decoded base64 contents.
Here is the code I use to send the email:
$base64contents = rtrim(chunk_split(base64_encode($message)));
$to = "kit@huntingsportsplus.net";
$subject = "$lastName, $firstName - $propertyCounties, $propertyStates - $totalAcreage Acres - $emailAddress";
$headers .= "From: info@hunt-private-land.com" . "\r\n";
$headers .= "Cc: " . "\r\n";
$headers .= "Bcc: cameron@huntingsportsplus.com" . "\r\n";
$headers .= "Content-Type: text/html" . "\r\n";
$headers .= "Content-Transfer-Encoding: base64" . "\r\n";
mail($to,$subject,$base64contents,$headers);
One thing that has changed right before the emails stopped loading correctly is this; we just switched from a shared hosting plan to a virtual dedicated server. Is it possible that our new vd server does not support base64 encoded emails?
Please help me out here.
BTW - when I copy the "nonsense" in the emails and paste it into an online base64 encoder/decoder it comes out as html, and when I plug this html into my html editor, the html loads just as it should in the preview pane - everything seems to be fine within the html once it has been decoded from the base64 garble.
$base64contents = rtrim(chunk_split(base64_encode($message)));
But, all of a sudden it quit working. Now instead of seeing my nice HTML tables and stuff, I just see a bunch of base64 nonsense.
I am using Mozilla Thunderbird to receive emails, and I set it to where I can see all of the headers for the email, and on the old emails it shows this as a header:
Content-Transfer-Encoding: base64
but on the new emails (that don't load correctly) that header is missing, and instead it appears in the body of the email just before the un-decoded base64 contents.
Here is the code I use to send the email:
$base64contents = rtrim(chunk_split(base64_encode($message)));
$to = "kit@huntingsportsplus.net";
$subject = "$lastName, $firstName - $propertyCounties, $propertyStates - $totalAcreage Acres - $emailAddress";
$headers .= "From: info@hunt-private-land.com" . "\r\n";
$headers .= "Cc: " . "\r\n";
$headers .= "Bcc: cameron@huntingsportsplus.com" . "\r\n";
$headers .= "Content-Type: text/html" . "\r\n";
$headers .= "Content-Transfer-Encoding: base64" . "\r\n";
mail($to,$subject,$base64contents,$headers);
One thing that has changed right before the emails stopped loading correctly is this; we just switched from a shared hosting plan to a virtual dedicated server. Is it possible that our new vd server does not support base64 encoded emails?
Please help me out here.
BTW - when I copy the "nonsense" in the emails and paste it into an online base64 encoder/decoder it comes out as html, and when I plug this html into my html editor, the html loads just as it should in the preview pane - everything seems to be fine within the html once it has been decoded from the base64 garble.