Opened 9 years ago

Closed 9 years ago

#24575 closed Uncategorized (wontfix)

Add an option to smtp.EmailBackend for DKIM signing

Reported by: Loek van Gent Owned by: nobody
Component: Core (Mail) Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

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

Change History (2)

comment:1 by Tim Graham, 9 years ago

It could be useful. On the other hand, it adds more settings and a dependency on another library. I don't have a sense if enough people will use it that it makes sense to include it in core as opposed to making it an external app. Could you raise the idea on the DevelopersMailingList?

comment:2 by Tim Graham, 9 years ago

Resolution: wontfix
Status: newclosed

The mailing list thread seemed to conclude that DKIM is the responsibility of an MTA, not Django, so this wouldn't be a good candidate for inclusion in core.

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