Reputation: 49
I have integrated sendgrid in my app as follows:
SENDGRID_API_KEY = os.getenv('SENDGRID_API_KEY')
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.sendgrid.net'
EMAIL_HOST_USER = 'apikey'
EMAIL_HOST_PASSWORD = SENDGRID_API_KEY
EMAIL_PORT = 587
EMAIL_USE_TLS = True
DEFAULT_FROM_EMAIL = "[email protected]"
I run a test from manage.py shell as the below and I received the test email.
from django.core.mail import send_mail
send_mail('Subject here', 'Here is the message.', '[email protected]',
['[email protected]'])
On my website, after clicking forget password and filling in a registered user email, the page redirects to a page that says email sent. But I did not receive any email. There is no debug info and I cannot figure out where it went wrong.
I am on pythonanywhere if that makes a difference. I integrated allauth so users can login with email instead of username.
Upvotes: 0
Views: 328
Reputation: 49
I am using a paid account on Pythonanywhere. I found the problem. The ISP rejected the email for some reason. When I changed the account to another email, it worked out fine. I realised this after seeing on sendgrid dashboard that a few requests were made but not delivered.
Upvotes: 0