LeoneBacciu / django-email-verification

A Django app that takes care of verifying a users's email address and activating their profile.
MIT License
353 stars 57 forks source link

Why thread sending email without documentation? #76

Closed evanlesmez closed 1 year ago

evanlesmez commented 1 year ago

I manually called send_email in a loop through all the existing users in my db.

https://github.com/LeoneBacciu/django-email-verification/blob/c8ac4aca73345145eacbf8633ea0706b2688aa84/django_email_verification/confirm.py#L23

I received numerous SMTPRecipientsRefused errors, which I had not seen in development.

....
File "/usr/lib/python3.10/smtplib.py", line 901, in sendmail
    raise SMTPRecipientsRefused(senderrs)
smtplib.SMTPRecipientsRefused: {'example@email: (451, b'siteground.us received more than 10.3 messages for 1s . Service\ntemporary unavailable, message deffered, try again later.')}
...

I was worried that this might be a defect of Django send_email with the site ground server, which I planned to use routinely for verified users. I played with that in the shell and clearly saw that it was executing as expected, in a chronological blocking fashion.

So I investigated your source code and saw this:

https://github.com/LeoneBacciu/django-email-verification/blob/c8ac4aca73345145eacbf8633ea0706b2688aa84/django_email_verification/confirm.py#L47

Why thread sending emails by default? And since it was chosen, why not document that on the README.md?