New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed #35365 -- Add RFC 3824 Auto-Submitted header to emails by default #18099
base: main
Are you sure you want to change the base?
Conversation
Implemented the default behaviour of attaching Auto-Submitted : auto-generated header to emails by default. Created subclass of EmailMessage that allows users to opt-out of this default. Added unit tests for this added functionality.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello! Thank you for your contribution 💪
As it's your first contribution be sure to check out the patch review checklist.
If you're fixing a ticket from Trac make sure to set the "Has patch" flag and include a link to this PR in the ticket!
If you have any design or process questions then you can ask in the Django forum.
Welcome aboard ⛵️!
django/core/mail/message.py
Outdated
@@ -280,9 +280,15 @@ def message(self): | |||
if "message-id" not in header_names: | |||
# Use cached DNS_NAME for performance | |||
msg["Message-ID"] = make_msgid(domain=DNS_NAME) | |||
|
|||
if "Auto-Submitted" not in self.extra_headers: | |||
# Default to adding the Auto-Submitted : auto-generated header |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should not be a space after "Auth-Submitted" (also in other places).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I'd ask this comment be removed pls. We have a policy of not commenting the "what", rather focusing on commenting the "why" 👍
@@ -193,7 +193,9 @@ Decorators | |||
~~~~~ | |||
|
|||
* ... | |||
* :class:`<django.core.mail.EmailMessage>` now attaches a default header of "Auto-Submitted : auto-generated" | |||
to outgoing emails. You can opt-out of this by using :class:`<django.core.mail.NoAutoSubmittedHeaderEmailMessage>` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The angle brackets are not required and should be removed.
Implemented the default behaviour of attaching Auto-Submitted: auto-generated header to emails by default. Created subclass of EmailMessage that allows users to opt-out of this default. Added unit tests for this added functionality.
This is just minor syntax fixes for previous comments. I am going to implement the changes mentioned in the Trac Ticket thread in the next iteration of the PR. |
Implemented the default behaviour of attaching Auto-Submitted : auto-generated header to emails by default. Created subclass of EmailMessage that allows users to opt-out of this default. Added unit tests for this added functionality.
Implemented the default behaviour of attaching Auto-Submitted : auto-generated header to emails by default. Created subclass of EmailMessage that allows users to opt-out of this default. Added unit tests for this added functionality.
Trac ticket number
ticket-35365
Branch description
RFC 3824 (https://www.rfc-editor.org/rfc/rfc3834) defines the Auto-Submitted header for emails to avoid mail loops. Based on this, the EmailMessage class now attaches a default header of "Auto-Submitted : auto-generated" to emails. The user can opt-out of this default by using the NoAutoSubmittedHeaderEmailMessage subclass. This will remove the "Auto-Submitted : auto-generated" header.
Checklist
main
branch.