Reputation: 55
settings.py
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER ='[email protected]'
EMAIL_HOST_PASSWORD = '#########'
EMAIL_POST = '587'
above are the settings for the Django core mail module.
from django.conf import settings
from django.core.mail import EmailMultiAlternatives
emailFrom = [settings.EMAIL_HOST_USER]
emailTo ='[email protected]'
text_content = 'Your content here'
email_subject = "Subject here"
msg = EmailMultiAlternatives(email_subject, text_content, emailFrom, [emailTo], )
msg.send()
return HttpResponse('We have sent a email verification please check your email')
I am using its EmailMultiAlternatives to send emails to users. When I try to build the program with the Gmail SMTP it throws the following error
'Errno 10060 A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond'.
I am doing this in my sample project, somewhere else, or let me know where I am going wrong. ? please help me thanks in advance
Upvotes: 0
Views: 1316