Opened 10 years ago

Closed 10 years ago

#23490 closed Bug (duplicate)

Email send error: "See http://pobox.com/~djb/docs/smtplf.html"

Reported by: maherma-adg Owned by: nobody
Component: Core (Mail) Version: 1.6
Severity: Normal Keywords: email smtplf
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I found a bug sending multipart emails from django 1.6 (over python3) when target mail server is QMail.

The received error is "451, See http://pobox.com/~djb/docs/smtplf.html"

Tracing code show me that multipart encode data is generated with "\n" line separator which violate email specifications.

Test enviroment:
OSX 10.9.4
Django 1.6.6
Python 3.4.1
Mail server: QMail

You can fix this issue modifing this line in file /core/mail/message.py:153

- g.flatten(self, unixfrom=unixfrom)
+ g.flatten(self, unixfrom=unixfrom, linesep = '\r\n')

This modification replace lineseparator in multipart data from \n to \r\n allowing mails to be sent.

This is not a permanent fix but can be a starting point.

Manuel.

Change History (3)

comment:1 by maherma-adg, 10 years ago

Component: Python 3Core (Mail)

comment:2 by Aymeric Augustin, 10 years ago

Triage Stage: UnreviewedAccepted

The doc for flatten says:

Optional linesep specifies the line separator character used to terminate lines in the output. If specified it overrides the value specified by the msg's or Generator's policy.

Since Django doesn't specify a policy, I believe we end up with the default policy, which is documented to exhibit this bug. The proper fix is to switch to the SMTP policy.

The easiest way is to inject it when we instanciate the Generator. But I'm wondering if it wouldn't be safer to set it on the message, to avoid the same kind of bugs in other code paths.

comment:3 by Florian Apolloner, 10 years ago

Resolution: duplicate
Status: newclosed

Closing in favor of #23063 which is the older ticket (and I like tcpdumps ;))

Note: See TracTickets for help on using tickets.
Back to Top