#9214: Allow different `MAIL FROM` or `Return-Path` and `From` headers. -------------------------------------------+-------------------------------- Reporter: mrmachine | Owner: nobody Status: new | Milestone: Component: django.core.mail | Version: 1.0 Keywords: EmailMessage Return-Path From | Stage: Unreviewed Has_patch: 0 | -------------------------------------------+-------------------------------- Currently, `EmailMessage.message` sets the `From` header to match the `from_email` argument in `EmailMessage.__init__`. This value is also passed as the `from_addr` argument to `smtplib.SMTP.sendmail`, which specifies the `MAIL FROM` or `Return-Path` header.
This makes it impossible to specify a `MAIL FROM` or `Return-Path` header that is different to the `From` header. This can be a requirement for [http://en.wikipedia.org/wiki/VERP VERP] or other list / bounce management, and also makes it impossible to set a valid `From` header with multiple identities. [http://www.ietf.org/rfc/rfc2822.txt RFC2822] states that the `From` header specifies the author(s) of the message (those responsible for the writing of the message), who are not necessarily responsible for sending or delivery of the message. The `MAIL FROM` or `Return-Path` headers should refer to a single identity, who is responsible for the delivery of the message. This is where bounce messages will go. I propose that the cleanest solution to this is to change the relevant line from `EmailMessage.message` to get the `From` header from `self.extra_headers` if it exists, and fallback to `self.from_email` as the default. This should be entirely backwards compatible, and will allow users to override the `From` header either for bounce / list management, or to list multiple authors. Currently, if a `From` header is passed in the `headers` argument, the resulting message simply contains two `From` headers, which could yield unexpected results. This change is important for anyone operating a mailing list, a subscription based email newsletter, or sending any email on behalf of their users or another 3rd party if they want to adhere to anti-SPAM requirements and best practices, e.g. SPF and Sender ID records, catching and removing subscribers who have sent bounce messages, etc. -- Ticket URL: <http://code.djangoproject.com/ticket/9214> Django <http://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 post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~---
