Skip to content

pyramid mailer incorrectly encodes from-header if international characters exist #99

@ztane

Description

@ztane

Python 3.10, if relevant,

>>> m = pyramid_mailer.message.Message(sender='ÄÖ <foo@bar>', recipients=['baz@quux'], body='foo')
>>> print(m.to_message().as_string())
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
From: =?utf-8?b?w4TDliA8Zm9vQGJhcj4=?=
To: baz@quux
Content-Disposition: inline

foo

The header is incorrectly quoted, the quoting must not affect the actual header. For example Amazon SES is unable to handle this. Not sure if anything else would either. I guess the fix would be to use the email.message.EmailMessage from Python 3.6+.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions