django-templated-email icon indicating copy to clipboard operation
django-templated-email copied to clipboard

from_email should accept None and set DEFAULT_FROM_EMAIL in that case

Open fjsj opened this issue 8 years ago • 3 comments

What do you think @aericson ?

fjsj avatar Dec 01 '16 18:12 fjsj

I believe the idea here was to mimic as close as possible the arguments of django.core.mail.send_mail

If we decide to change, what would be the correct approach to do this while keeping the backward compatibility and args order? Leave all other required arguments with None default and manually raise ValueError if they are None?

On a side note: Because of Django's EmailMessage, even though it's not ideal, if you pass None as a from_email it will fall back to use the DEFAULT_FROM_EMAIL. [1]

aericson avatar Dec 03 '16 18:12 aericson

Yes, the idea is to mimic Django behavior. But if we're going to lose backward compatibility for arg order, then don't worry.

We should only have a test to ensure from_email=None falls back to DEFAULT_FROM_EMAIL

fjsj avatar Dec 03 '16 19:12 fjsj

Am I understanding this correctly: if settings.TEMPLATED_EMAIL_FROM_EMAIL is not set, then, because of Django, it will fall back to DEFAULT_FROM_EMAIL? From the documentation, I was under the impression that TEMPLATED_EMAIL_FROM_EMAIL was a required setting if you did not specify from_email... It may just be a silly assumption on my part, do you think it's worth clarifying in the docs?

QasimK avatar Mar 28 '18 13:03 QasimK