#32633 closed Cleanup/optimization (worksforme)

send_mail must make `from_email` argument optional

Reported by: Aryan Iyappan Owned by: nobody
Component: Core (Mail) Version: 3.2
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

the django docs state that, while sending mail, if no from_email is passed, it will use the DEFAULT_FROM_EMAIL.
source: https://docs.djangoproject.com/en/3.1/topics/email/

from_email: A string. If None, Django will use the value of the DEFAULT_FROM_EMAIL setting.

However, when using the send_mail function, the from_email argument is not optional.
A workaround for this right now is this.

        send_mail(
            subject=subject,
            message=message,
            recipient_list=[self.user.email],
            from_email=None
         )

giving a default value of None to it will resolve this issue.

Change History (3)

comment:1 Changed 10 months ago by Aryan Iyappan

comment:2 Changed 10 months ago by Aryan Iyappan

Has patch: set

comment:3 Changed 10 months ago by Nick Pope

Resolution: worksforme
Status: newclosed

DEFAULT_FROM_EMAIL will be used if you explicitly pass None to the from_email argument.

We cannot change the order of arguments as it would be backward-incompatible.

Note: See TracTickets for help on using tickets.
Back to Top