Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Comprehensive mailing tools for PHP
PHP Shell

bug #627 Only add soft line break when necessary (c960657)

This PR was merged into the 5.x branch.


Only add soft line break when necessary

In quoted-printable encoding, the encoding lines should not exceed 76 characters. If there are longer lines in the source text, a soft line break should be added.

It is only necessary to add soft line breaks when a line in the source exceeds 76 characters. However, Swift_Encoder_QpEncoder and Swift_Mime_ContentEncoder_QpContentEncoder add soft line breaks every 76 character, ignoring any line breaks already present in the source.

This behaviour does not violate the spec, but it makes the encoded text harder to read with the human eye. Of course most people don't do this, but it is annoying when debugging, or when using a very primitive mail reader. One of the design goals of quoted-printable is to make the encoded text human-readable (unlike base64 encoding).

With this PR, the line length counter is reset every time a line break is encountered in the source text.

The change is implemented symmetrically for QpEncoder and QpContentEncoder. However, I did not add a change to QpContentEncoderAcceptanceTest similar to that made to QpEncoderAcceptanceTest,   because that revealed another bug, #620.


6fe0e13 Only add soft line break when necessary
latest commit 0a6e903137
@fabpot fabpot authored


Swift Mailer

Swift Mailer is a component based mailing solution for PHP 5.
It is released under the MIT license.


Swift Mailer is highly object-oriented by design and lends itself
to use in complex web application with a great deal of flexibility.

For full details on usage, see the documentation.
Something went wrong with that request. Please try again.