VN:F [1.9.22_1171]
Rating: 7.3/10 (3 votes cast)

Hey guys, Today one of my reporting tool was having an issue with its mail content. The tool is suppose to give me report for the previous days management processes done by my users.

I have noticed that in the EMAIL content there were some Exclamation marks (!) at odd places.
FOR EXAMPLE
Rober!t HAS DON!E 80! TRANSACTIONS likewise.

HOW TO FIX THIS ISSUE?
All you have to do is just add this HEADER on your PHP mail.

‘Content-Transfer-Encoding’ => ‘base64’

and encode the MAIL CONTENT like this

$base64_message_contents = rtrim(chunk_split(base64_encode($complete_message)));

The entire code will look similar to this.

$smtp = Mail::factory('smtp',
array ('host' => '192.1.1.1',
'auth' => true,
'username' => '[email protected]',
'password' => '*****'));
$headers = array ('From' => '[email protected]',
'Subject' => 'Report Trans','MIME-Version' => '1.0','Content-type' => 'text/html; charset=iso-8859-1','Content-Transfer-Encoding' => 'base64');
$base64_message_contents = rtrim(chunk_split(base64_encode($complete_message)));
$mail = $smtp->send($mail_send[$i], $headers, $base64_message_contents );
VN:F [1.9.22_1171]
Rating: 7.3/10 (3 votes cast)

Leave a Reply

Your email address will not be published. Required fields are marked *