[New-bugs-announce] [issue14983] [patch] email.generator should always add newlines after closing boundaries

Dmitry Shachnev report at bugs.python.org
Sat Jun 2 08:52:22 CEST 2012

New submission from Dmitry Shachnev <Mitya57 at gmail.com>:

Trying to write a email-sending script with PGP-signing functionality, I stumbled upon a problem (see [1]): it was impossible to sign mutlipart emails (actually the signing was performed, but the verifying programs thought that the signature is bad).

After comparing messages produced by email.generator and popular mail clients (Evolution, KMail), I've found out that the mail clients always add line breaks after ending boundaries.

The attached patch makes email.generator behave like all email clients. After applying it, it's possible to sign even complicated mails like "multipart/alternate with attachments".

An illustration:

 --====1==     # Part 1 (base message) begin
 --====2==     # Part 1.1 begin
 --====2==     # Part 1.2 begin
 --====2==--   # Part 1 end
               # There should be empty line here
 --====1==     # Part 2 (signature) begin
 --====1==--   # End of the message

[1]: http://stackoverflow.com/questions/10496902/pgp-signing-multipart-e-mails-with-python

components: email
files: always_add_newlines.patch
keywords: patch
messages: 162126
nosy: barry, mitya57, r.david.murray
priority: normal
severity: normal
status: open
title: [patch] email.generator should always add newlines after closing boundaries
type: behavior
versions: Python 3.2
Added file: http://bugs.python.org/file25798/always_add_newlines.patch

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list