Invalid content on base64 encoded emails after server update
Posted: Thu Mar 22, 2012 1:21 am
I recently found that all my base64 encoded emails are not incorrectly encoded. The reason is I updated the server.
The email came as below.
This is not the message I expected.
After several attempts, I found the reason for this.
On the php code, I was having,
I found out, these needs to be changed as below (removing \r),
All worked as expected. Hope this will help!
The email came as below.
Code: Select all
Content-Transfer-Encoding: base64
Message-Id: <[email protected]>
Date: Wed, 20 Mar 2012 20:05:14 +0530 (GMT)
LS0tLS1CRUdJTiBQR1AgTUVTU0FHRS0tLS0tClZlcnNpb246IEdudVBHIHYxLjQuNSAoR05VL0xp
bnV4KQoKaFFJT0F6SzVKcHZnNWJLR0VBZi9RaUkza3llcW9KL0NCU3l3SjVCZ0Z6UzJZOHByUGxD
WlFpTis0eHN2VVM2MwpXbTVjQzM2MUNCamFXMWIxc2kvR1NYMTlCTSsxdHNqenZVcGxaNXlDNFdM
....
....
After several attempts, I found the reason for this.
On the php code, I was having,
Code: Select all
$headers = 'From: [email protected]' . "\r\n";
$headers .= 'Content-Transfer-Encoding: base64' . "\r\n";
Code: Select all
$headers = "From: [email protected]\n";
$headers .= "Content-Transfer-Encoding: base64\n";