Hi David,

Does and should Django connect directly to a remote SMTP server? Isn't it
better to use the local mail server which will receive the email and then
send it to a remote SMTP server? In my opinion, it's always better to send
emails via a local mail server on the same machine. Do you have other
experiences?

Thanks,
Uri Rodberg, Speedy Net.
אורי
u...@speedy.net


On Wed, Sep 7, 2022 at 5:21 PM David Miguel Susano Pinto <
carandr...@gmail.com> wrote:

> 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
> <https://groups.google.com/d/msgid/django-developers/eaa81e50-cfd0-4cbd-ac75-3ad36fc50c51n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CABD5YeGWKjHYGtzRwpZFkLWvAXJpnQmYjHBa_2inYXpx4f6C5A%40mail.gmail.com.

Reply via email to