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

Can't send email in production environment #63

Closed rsinnock closed 1 year ago

rsinnock commented 2 years ago

I'm hoping this is a simple oversight on my part, but I've been trying to figure this out for days and can't seem to isolate the issue. I hesitated to file this here rather than SO, but I'm thinking maybe there is something specific to this module that I'm missing.

I've got the email verification working correctly in my local environment using SendGrid as the email provider. However, when deployed in my production environment it won't send out the confirmation email.

Things I've checked so far:

My settings file looks like this:

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.sendgrid.net'
EMAIL_HOST_USER = str(os.getenv('EMAIL_HOST_USER'))
EMAIL_HOST_PASSWORD = str(os.getenv('EMAIL_HOST_PASSWORD'))
EMAIL_PORT = 587
EMAIL_USE_TLS = True
DEFAULT_FROM_EMAIL = 'xxx <donotreply@mydomain.com>'

# Settings for Email-Verification
def verified_callback(user):
    user.is_active = True

EMAIL_VERIFIED_CALLBACK = verified_callback
EMAIL_FROM_ADDRESS = 'xxx <donotreply@mydomain.com>'
EMAIL_MAIL_SUBJECT = 'Confirm your email'
EMAIL_MAIL_HTML = 'timeline/mail_body.html'
EMAIL_MAIL_PLAIN = 'timeline/mail_body.txt'
EMAIL_TOKEN_LIFE = 60 * 180
EMAIL_PAGE_TEMPLATE = 'timeline/email_confirm_template.html'
EMAIL_PAGE_DOMAIN = str(os.getenv('EMAIL_PAGE_DOMAIN'))
EMAIL_MULTI_USER = True  # optional (defaults to False)

Any suggestions you can offer would be appreciated.

LeoneBacciu commented 1 year ago

Seeing that a lot of time has passed, I am going to close this issue, feel free to reopen it if you need.