﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
18861	The test email backend (locmem) should perform more validation of messages	Bruno Renié	nobody	"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."	Bug	closed	Core (Mail)	dev	Normal	fixed			Ready for checkin	1	0	0	0	0	0
