﻿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
24575	Add an option to smtp.EmailBackend for DKIM signing	Loek van Gent	nobody	"DKIM signing of emails is sensible to avoid being regarded as spam.
Here's a example of an `EmailBackend` that does the signing, although I think it makes sense to add it as an option to `core.mail.backends.smtp.EmailBackend`.

{{{
class DKIMBackend(EmailBackend):
    def _send(self, email_message):
        """"""A helper method that does the actual sending + DKIM signing.""""""
        if not email_message.recipients():
            return False
        try:
            message_string = email_message.message().as_string()
            signature = dkim.sign(message_string,
                                  settings.DKIM_SELECTOR,
                                  settings.DKIM_DOMAIN,
                                  settings.DKIM_PRIVATE_KEY)
            self.connection.sendmail(email_message.from_email, email_message.recipients(), signature+message_string)
        except:
            if not self.fail_silently:
                raise
            return False
        return True
}}}"	Uncategorized	closed	Core (Mail)	dev	Normal	wontfix			Unreviewed	0	0	0	0	0	0
