Can't send email in production environment
rsinnock opened this issue · 1 comments
rsinnock commented
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:
- it's not showing any errors when I put it into debug mode
- email host and credentials are the same as my local environment
- I'm able to send email via SendGrid in the production env (e.g. the password reset emails work), just not the confirmation email
- the EMAIL_PAGE_DOMAIN is set correctly
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
Seeing that a lot of time has passed, I am going to close this issue, feel free to reopen it if you need.