I am using the email module in Django to inform of users with their 
registration. Sometimes it can send email successfully, but more often, it 
fails. I searched for many solutions, but did not change this situation.

The following is what I have configured:
settings.py:
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.139.com'
EMAIL_PORT = 25
EMAIL_HOST_USER = 'EmailAddress' 
EMAIL_HOST_PASSWORD = 'xxxxxxxxxxxxxxxx'
EMAIL_FROM = 'xxxxxx<EmailAddress>'
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
EMAIL_USE_TLS = False  


views.py:
import smtplib
def sendEmail(subject, message, from_email, to_email):
    try:
        send_mail(subject, message, from_email, [to_email], fail_silently=
False)
        return True
    except smtplib.SMTPException as e:
        print(e)
        return False

Although I used the 'try', 'except' to catch the error, I still find no 
results in the output. Is there anything wrong? I would be very grateful if 
someone can give me some advice. Thanks in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d869f7c6-8e32-428e-a1dc-6c769de3b6afn%40googlegroups.com.

Reply via email to