Hi, thank you for this project it saved me a lot of time!
I have a question about handling exceptions from Anymail and generally any e-mail backend.
My function sends an e-mail:
from django.core.mail import EmailMessage
def dummy():
email = EmailMessage(
"subject",
"body",
"from@example.com"
["to@example.com"],
)
email.send()
Is there any general way to catch the exception from email backends other than using broad Exception?
By default Django raises smtplib.SMTPError and anymail has AnymailAPIError.
This would mean that for each email backend I'd have to add its exception in the test:
try:
email.send()
except SMTPException,AnymailAPIError :
pass # do something useful
I noticed there was once a proposal for this https://code.djangoproject.com/ticket/23944
I'm wondering if anyone is aware of any development in the Django ecosystem since I'm pretty new to Django.
Even though it's highly unlikely I'll be changing the email backend, I'm still interested in the answer.
Thank you.
Hi, thank you for this project it saved me a lot of time!
I have a question about handling exceptions from Anymail and generally any e-mail backend.
My function sends an e-mail:
Is there any general way to catch the exception from email backends other than using broad
Exception?By default Django raises
smtplib.SMTPErrorand anymail hasAnymailAPIError.This would mean that for each email backend I'd have to add its exception in the test:
I noticed there was once a proposal for this https://code.djangoproject.com/ticket/23944
I'm wondering if anyone is aware of any development in the Django ecosystem since I'm pretty new to Django.
Even though it's highly unlikely I'll be changing the email backend, I'm still interested in the answer.
Thank you.