Why is my send_mail () command not working in Django?

I placed the following in my settings.py file. The email address is a test one. I found the email settings from the Webfaction site:

EMAIL_HOST = 'smtp.webfaction.com'
EMAIL_HOST_USER = 'hekevintran_test'
EMAIL_HOST_PASSWORD = 'testpass'
EMAIL_PORT = 465
EMAIL_USE_TLS = True

This is what my file looks like:

from django.core.mail import send_mail

send_mail(subject='subject',
          message='message',
          from_email='hekevintran_test@webfaction.com',
          recipient_list=['recipient@yahoo.com'],
          fail_silently=False)

When I run above, it lingers for a long time, and then gives me this error:

SMTPServerDisconnected: Connection unexpectedly closed

What am I doing wrong?

+5
source share
3 answers

Django Webfaction, . , EMAIL_PORT EMAIL_USE_TLS. , Django , .

, :

EMAIL_PORT = 25
EMAIL_USE_TLS = False
+11

asmallorange.com. . , 465 .

+1

. EMAIL_PORT EMAIL_USE_TLS = True. .

0

All Articles