Fix incorrectly encoded headers in MailTransport.

When encoded values are present in header fields, they need to have
newlines removed as leaving the newlines in place and interfere with
delivery on Qmail based SMTP servers.

Fixes #2209
Add missing return type
Merge pull request #2282 from bcrowe/hotfix-returnType

Add missing return type
Merge branch 'master' into 2.5
Improve readability and optimize minimizing variable lookups.
Only generate query data for hasOne and belongsTo associations.

Avoid calling generateAssociationQuery():

* when the return value will never be usefull (True in this case)
* to avoid polluting $queryData with uneeded fields

Later, the SQL statement for the primary, and 'hasOne' plus 'belongsTo'
relationships, is built.
Remove unnecessary call to getDataSource().
Move variables to logical blocks.
Unindent to ease readability, and avoid assigning variables when
unneeded.
Free a little memory before entering to recursive intensive loops.
Remove unneeded test inside conditional.
Remove unused $resultSet argument from generateAssociationQuery().