#447 base64 encode attach with invalid line lengths (bug 1473714)


Diffed against current subversion class/deliver/Deliver.class.php revision 13067

Fixes bug 1473714. Patch to Delivery.class.php. Current behavior of writeBodyPart is to 8bit encode attachments of content-type text and content-type message. In circumstances where the attachment has lines greater than 998 characters this results in non rfc 2822 2.1.1 (Line Length Limits) compliant attachments.

The current stable Cyrus IMAP (2.2.12) will choke on these long lines if they are in the neighborhood of 9000 characters and longer, and will reject delivery with a 554 5.6.0 Message contains NUL characters (in reply to end of DATA command))

I found this to be an issue for users using SquirrelMail to forward and reply to mail with that was delivered to them text/html attachments that lacked line breaks.

This patch will base64 encode message parts with attachment filenames even if they are of content type text or content type message.

Functions writeBodyPart and prepareMIME_Header were updated.


  • Kelly Fallon

    Kelly Fallon - 2008-11-06

    Updated version of this patch that will selectively base64 encode only the text/message attachments that have long lines instead of all of them. Added new function hasLongLines to Deliver class.

    File Added: selectively_base64_encode_attch_with_long_lines.patch

  • Kelly Fallon

    Kelly Fallon - 2008-11-06

    Adding patch for squirrelmail-1.4.9a to selectively base64 encode attachments with over long lines.

    File Added: SquirrelMail-1.4.9a-2_attachment_encoding.patch

  • Kelly Fallon

    Kelly Fallon - 2008-11-12

    File Added: SquirrelMail-1.4.9a-2_attachment_encoding.patch

  • Paul Lesniewski

    Paul Lesniewski - 2009-04-03

    Not sure why you are using 1.4.9 - perhaps it's a Debian package. I'd recommend downloading from our site directly, since otherwise you are not likely to see this or other fixes any time soon... and we only support our unmodified (not downstream) product here (and that's what we'd like patches to be against as well).

    In any case, thanks very much for your help. A slightly modified version of this patch has been applied to both 1.4.18SVN and 1.5.2SVN.

    Let us know if you see any problems with it. Thanks again!

  • Paul Lesniewski

    Paul Lesniewski - 2009-04-03
    • status: open --> closed-accepted

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks