#24575: Add an option to smtp.EmailBackend for DKIM signing
-------------------------------+--------------------
Reporter: gannetson | Owner: nobody
Type: Uncategorized | Status: new
Component: Core (Mail) | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
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
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24575>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/052.bc939f99a756988f5f3d3b4964843aed%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.