Content-Transfer-Encoding: BASE64 emails

I came across a hosting provider who sent mail() data base64 encoded. This is fine but I had to modify my script a little to work with it.

Here’s part of the script before hand (notice the newline character in the mail header string)

$headers .= 'MIME-Version: 1.0' . "rn";	
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "rn";
$headers .= "rn";

Here’s the script afterwards which now works fine on this hosting account (new line characters removed)

$headers .= 'MIME-Version: 1.0' . "rn";	
$headers .= 'Content-type: text/html; charset=iso-8859-1';

This does open up room for mail header injection if your hosting provider switches away from base64 encoding emails. So just keep an eye on emails to make sure. Shouldn’t be a problem.

Leave a Reply
Your email will not be published