[patch] Better default value for SERVER_EMAIL
|Reported by:||Fraser Nevett <mail@…>||Owned by:||nobody|
|Cc:||Triage Stage:||Design decision needed|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Neither mail_managers() nor mail_admins() allow you to specify the address from which their email should be sent, but instead use the value of SERVER_EMAIL from the settings file. This is fine, but the default is 'root@localhost'.
Some MTAs (such as Postfix) will automatically append a domain suffix to this, as it knows that 'localhost' won't resolve on the Internet and it tries to convert it into a fully qualified hostname (e.g. 'root@localhost' would become 'root@…').
As such a hostname will not usually exist, some email servers will reject messages from this sender as it assumes that it is a spoofed address.
Obviously, an easy solution is just to define SERVER_EMAIL to something sensible in your settings file! However, should you neglect (or forget) do do this, it would be nice if Django had a default value that was more likely to be a real email address.
The attached patch defines this variable using the machine's hostname.
A similar issue exists with DEFAULT_FROM_EMAIL, which the patch also addresses.
Change History (6)
Changed 10 years ago by Fraser Nevett <mail@…>
comment:4 Changed 9 years ago by Simon G. <dev@…>
- Triage Stage changed from Unreviewed to Design decision needed