Re: [Django] #35365: Add RFC 3834 Auto-Submitted header to emails by default

5 views
Skip to first unread message

Django

unread,
Apr 25, 2024, 1:54:50 AMApr 25
to django-...@googlegroups.com
#35365: Add RFC 3834 Auto-Submitted header to emails by default
---------------------------------+------------------------------------
Reporter: Tobias Bengfort | Owner: cgracin
Type: New feature | Status: assigned
Component: Core (Mail) | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Comment (by Tobias Bengfort):

The documentation already contains this line:

Not all features of the EmailMessage class are available through the
send_mail() and related wrapper functions. If you wish to use advanced
features, such as BCC’ed recipients, file attachments, or multi-part
email, you’ll need to create EmailMessage instances directly.
https://docs.djangoproject.com/en/5.0/topics/email/#the-emailmessage-
class

For consistency I think we should also add the `Auto-Submitted` header in
the wrapper functions.

The special thing here would be that dropping down to `EmailMessage`
allows you to ''remove'' a header rather than add one. I am not sure how
best to explain that in the docs. I see that most parameters are only
documented once for `send_mail()` and not repeated for the other wrapper
functions. So maybe it would be sufficient to add a note only to
`send_mail()`. The note could be something like this:

`send_mail()` uses the `Auto-Submitted` mail header to indicate that
the mail was created by software rather than a human.
--
Ticket URL: <https://code.djangoproject.com/ticket/35365#comment:9>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Apr 26, 2024, 4:34:25 PMApr 26
to django-...@googlegroups.com
#35365: Add RFC 3834 Auto-Submitted header to emails by default
---------------------------------+------------------------------------
Reporter: Tobias Bengfort | Owner: cgracin
Type: New feature | Status: assigned
Component: Core (Mail) | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Comment (by cgracin):

Thank you guys for the comments, I'll work on implementing these requests
and submit an updated PR.
--
Ticket URL: <https://code.djangoproject.com/ticket/35365#comment:10>

Django

unread,
Apr 27, 2024, 12:21:24 AMApr 27
to django-...@googlegroups.com
#35365: Add RFC 3834 Auto-Submitted header to emails by default
---------------------------------+------------------------------------
Reporter: Tobias Bengfort | Owner: cgracin
Type: New feature | Status: assigned
Component: Core (Mail) | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Comment (by David Smith):

Does the header need to be removed entirely? Could we advise folk to set
the header to "no" to disable it?
https://www.iana.org/assignments/auto-submitted-keywords/auto-submitted-
keywords.xhtml

The current patch has this to add the header:

{{{
if "Auto-Submitted" not in self.extra_headers:
# Default to adding the Auto-Submitted: auto-generated header
self.extra_headers["Auto-Submitted"] = "auto-generated"
}}}

So could we documentat this by something like...

> By default `EmailMessage` sets the `Auto-Submitted` header to `auto-
generated` to indicate that the mail was created by software rather than a
human. The value of the `Auto-Submitted` header can be customised by the
`headers` option. To disable the header the value of `Auto-Submitted` can
be set to "no".
--
Ticket URL: <https://code.djangoproject.com/ticket/35365#comment:11>
Reply all
Reply to author
Forward
0 new messages