Opened 12 years ago

Closed 12 years ago

#18861 closed Bug (fixed)

The test email backend (locmem) should perform more validation of messages

Reported by: Bruno Renié Owned by: nobody
Component: Core (Mail) Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Currently the locmem email backend only stores EmailMessage instances on mail.outbox, and does not perform as much validation as other backends.

In particular, calling .message() on an EmailMessage instance creates a SafeMIMEText object which forbids multiline headers. All email backends call .message() except for the locmem backend. This is a opportunity for deployment surprises where sending an email would work during the tests but not in production if the subject is constructed using a template that has an EOL marker at the end of the file.

The attached patch naively calls .message() on each outgoing message to trigger this validation. This should be backwards-compatible since that error would be raised anyways when sending emails with a proper backend.

An alternative solution to this issue (email subjects ending with a newline) could be to strip all headers but this is a more intrusive change.

Attachments (2)

18861.patch (1.4 KB ) - added by Bruno Renié 12 years ago.
18861-2.diff (1.3 KB ) - added by Claude Paroz 12 years ago.
Move test in LocmemBackendTests

Download all attachments as: .zip

Change History (6)

by Bruno Renié, 12 years ago

Attachment: 18861.patch added

comment:1 by Bruno Renié, 12 years ago

Has patch: set

comment:2 by Aymeric Augustin, 12 years ago

Triage Stage: UnreviewedAccepted

by Claude Paroz, 12 years ago

Attachment: 18861-2.diff added

Move test in LocmemBackendTests

comment:3 by Claude Paroz, 12 years ago

Triage Stage: AcceptedReady for checkin

comment:4 by Claude Paroz <claude@…>, 12 years ago

Resolution: fixed
Status: newclosed

In 8599f64e54adfb32ee6550ed7a6ec9944034d978:

Fixed #18861 -- Triggered message validation with locmem email backend

Thanks Bruno Renié for the report and the initial patch.

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