If you are experiencing an issue where spaces are added into your email subject especially for dynamically generated subjects, consider using base64 encoding for your subject field in the email you send out or if you use non-latin characters or even binary data.

This problem occurs if you use xpertmailer for php which uses Quoted-printable encoding by default.

I quote one important information from the wikipedia page on Quoted-printable:

ASCII tab and space characters, decimal values 9 and 32, may be represented by themselves, except if these characters appear at the end of a line. If one of these characters appears at the end of a line it must be encoded as “=09″ (tab) or “=20″ (space).

If you are usingxpertmailer, you can set the encoding in the following manner:

$m = new MAIL5();



$m->Subject(‘Look at this example, it is a very’ .
‘ long subject line which may be subjected to ‘ .
‘spaces added unknowingly.’, ‘utf-8′, ‘base64′);

$m->Html = array(‘content’ => ‘Your email HTML content here’);

echo $m->Send(‘sendmail’) ? ‘Mail sent !’ : ‘Error !';

Blog Logo





1998 Nineteen-Ninety-Eight

Thoughts, stories and ideas.

Back to Overview