{{{
from django.core.mail import send_mail
send_mail(
f'Suspicious file requested from {client_ip} for {path}',
f'Suspicious file requested from {client_ip}.\nURL:
{absolute_url}',
'"Notifications" <er...@example.com>',
[Cfg.EMAIL_SUPPORT],
fail_silently=True,
)
}}}
If one emoves the double quotes:
{{{
send_mail(
f'Suspicious file requested from {client_ip} for {path}',
f'Suspicious file requested from {client_ip}.\nURL:
{absolute_url}',
'Notifications <er...@example.com>',
[Cfg.EMAIL_SUPPORT],
fail_silently=True,
)
}}}
Then the from field in gmail is:
{{{
'Notifications' via support <sup...@example.com>
}}}
Which is not what it was set to. The person's name was set to
`Notifications` not `'Notifications' via support`, and the from email
address was set to `er...@example.com` not `sup...@example.com`
This is my settings.py:
{{{
SERVER_EMAIL = f'sup...@example.com' # The reply to
DEFAULT_FROM_EMAIL = some...@example.com'
ADMINS = [('Support', 'sup...@example.com')]
MANAGERS = ADMINS
EMAIL_SUBJECT_PREFIX = "Example Server: "
}}}
THe documentation says:
{{{
from_email: A string. If None, Django will use the value of the
DEFAULT_FROM_EMAIL setting.
}}}
It does not specify this unusual behavior.
--
Ticket URL: <https://code.djangoproject.com/ticket/33498>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Old description:
New description:
This code will generate a 500 error instead of sending an email about the
404 error (the problem is the FROM field). It's a hard to error to find
{{{
from django.core.mail import send_mail
--
--
Ticket URL: <https://code.djangoproject.com/ticket/33498#comment:1>
* status: new => closed
* resolution: => needsinfo
Comment:
I'd guess this is a behavior of your mail server rather than Django. You
should debug further and reopen this ticket if you find that Django is at
fault.
--
Ticket URL: <https://code.djangoproject.com/ticket/33498#comment:2>