I have the following code in settings.py
#EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'sender@gmail.com'
EMAIL_HOST_PASSWORD = 'password'
EMAIL_PORT = 687
(I tried using TLS = True and ports using Ports 25, 567, 465, 687 and also tried smtp.gmail.com and other HOSTS from MX records, but I always got a connection refused )
Then I tried using port 687 and commented TLS = True. I get return value “0” for the following code
from django.core.mail import EmailMessage
email = EmailMessage('Subject', 'Body', 'me@gmail.com')
email.send()
I dont get any mail in my inbox. What does 0 mean ? What am I doing wrong ?
Any help would be appreciated,
Thanks,
Pankaj.
The EmailMessage returns 0 if you haven’t specified any recipients (to, bcc, cc). If you have no recipients the EmailMessage.send returns 0.
Also, Googles default smtp port is 587.