Proposal: Make the domain part of the Email Message-ID configurable

164 views
Skip to first unread message

Jacob Rief

unread,
Sep 6, 2020, 7:30:15 AM9/6/20
to Django developers (Contributions to Django itself)
When Django's mail subsystem generates an email, it creates a unique Message-ID. This is a requirement specified in RFC2822.
The domain part of that Message-ID is generated by the Python network utilities. It defacto is the domain name determined by a reverse DNS lookup.

This can cause some problems:
  1. Django web services often run on private networks and its DNS resolution could make that name quite common, such as 1.0.0.10.in-addr.arpa. This reduces the entropy to the generated Message-IDs.
  2. It may expose some details of the internal network setup. Not every sysadmin wants that.

Current state
The Message-ID is generated by:
django.core.mail.message.EmailMessage.message() 
Currently there is no way to configure the domain part inside this method.

Proposed state
Therefore I would suggest to add a new configuration directive to Django, say EMAIL_MESSAGEID_FQDN. Another possibility would be to allow to replace the hard-coded Message-ID generator email.utils.make_msgid() with a self-written callable.

Tim Graham

unread,
Sep 6, 2020, 5:50:35 PM9/6/20
to Django developers (Contributions to Django itself)
Hi, I think https://code.djangoproject.com/ticket/6989 has some discussion related to this.

Jacob Rief

unread,
Dec 7, 2020, 8:11:12 AM12/7/20
to Django developers (Contributions to Django itself)

Tim Graham

unread,
Dec 7, 2020, 9:50:19 AM12/7/20
to Django developers (Contributions to Django itself)
You don't need to announce a patch on the mailing list. Instead check "According to the ticket's flags, the next step(s) to move this issue forward are" on the ticket and update it accordingly. Thanks.
Reply all
Reply to author
Forward
0 new messages