Are you able to recreate this with 100% certainty? The functions which make the decision upon whether or not to encode are these:
Code: Select all
/**
* This function checks for 7bit *printable* characters
* which excludes \r \n \t etc and so, is safe for use in mail headers
* Actual permitted chars [\ !"#\$%&'\(\)\*\+,-\.\/0123456789:;<=>\?@ABCDEFGHIJKLMNOPQRSTUVWXYZ\[\\\]\^_`abcdefghijklmnopqrstuvwxyz{\|}~]
* Ranges \x00-\x1F are printer control sequences
* \x7F is the ascii delete character
* @param string Data to check against
* @return boolean
*/
function is7BitPrintable($data)
{
return (!preg_match('/[^\x20-\x7E]/', $data));
}
/**
* Check that a string does not contain any evil characters for headers.
* @param string The string to check
* @return boolean
*/
function isHeaderSafe($data)
{
return ($this->is7BitPrintable($data) && strpos($data, ";") === false);
}
Called like:
Code: Select all
//If the header is 7-bit printable it's at no risk of injection
if ($encoder->isHeaderSafe($row) && !$this->forceEncoding)
{
//snip (no encoding at all)
}
elseif ($this->encoding == "Q") //QP encode required
{
//snip (qp encoding -- this is where you're going!!)
}
elseif ($this->encoding == "B") //Need to Base64 encode
{
//snip (base64 encoding)
}
So either:
a) The address contains something that's matching '/[^\x20-\x7E]/', or that has a semi-colon in it
b) Encoding has been forced by calling $message->headers->forceEncoding(true);
I'll rule out the obvious one first

Have you called forceEncoding()?
EDIT | Or option c) One of the servers it relays through is changing the headers