After connecting to a SMTP server, a client identifies themselves with
a HELO/EHLO command, like so:

    HELO my-domain.example

While typically this is the client FQDN, that's not actually required
and in some setups the client needs to use some other name (it just
so happens that I'm in that situation).

Django's SMTP client defaults to `socket.getfqdn()`.

    https://github.com/django/django/blob/main/django/core/mail/
backends/smtp.py#L69
    https://github.com/django/django/blob/main/django/core/mail/utils.py#L16

This is a very good default but there is no option to set it to
something else.  I would propose a new option for it.  Some possible
names are:

- `MAIL_LOCAL_HOSTNAME`: because `local_hostname` is the name of the
  argument used by `smtplib` for this.

- `MAIL_HELO_DATA`: a clearer name, `helo_data` is used in the exim
  configuration.

- `MAIL_HELO_NAME`: even more clear, `helo_name` is used in the
  postfix configuration.

A workaround for this is to setup a SMTP server locally, such as Exim
or Postfix, that simply forwards the emails from Django.

Best wishes
David

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/eaa81e50-cfd0-4cbd-ac75-3ad36fc50c51n%40googlegroups.com.

Reply via email to