﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
33498	Email FROM: field unusual behavior of changing the input, can lead to errors	Michael	nobody	"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 due to no stack trace, had to binary search a lot of code to find it (cause it works fine with console email backend (i.e during dev)):

{{{
    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"" <error@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 <error@example.com>',
        [Cfg.EMAIL_SUPPORT],
        fail_silently=True,
    )
}}}

Then the from field in gmail is:
{{{
	'Notifications' via support <support@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 `error@example.com` not `support@example.com`

This is my settings.py:
{{{
SERVER_EMAIL = f'support@example.com'  # The reply to
DEFAULT_FROM_EMAIL = somebody@example.com'
ADMINS = [('Support', 'support@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."	Uncategorized	closed	Core (Mail)	4.0	Normal	needsinfo	email		Unreviewed	0	0	0	0	0	0
