I'm trying to use Amazon's new SMTP service for SES with Django 1.3.1 but I'm not having much luck.
I've created my SES SMTP credentials and have this in my settings:
EMAIL_USE_TLS = True
EMAIL_HOST = 'email-smtp.us-east-1.amazonaws.com'
EMAIL_HOST_USER = 'my-smtp-user'
EMAIL_HOST_PASSWORD = 'my-smtp-password'
EMAIL_PORT = 465
Then I try sending a test email (from and to verified email addresses):
from django.core.mail import send_mail
send_mail('Test subject', 'This is the body', 'info@abc.com',['hello@abc.com'], fail_silently=False)
But I get the following error:
SMTPServerDisconnected: Connection unexpectedly closed
I can telnet to the server:
telnet email-smtp.us-east-1.amazonaws.com 465
Any thoughts?
Thanks, G
I took like 3 hrs breaking my head over it. Your solution about the smtplib with s.starttls() and then s.login() is good with a python program with all the email credentials in the same file. But I don't think it is a clean way to do it in Django. So I finally figured it out. Irrespective of whether your machine is a 32 or a 64 bit. Just do the following steps:
Install boto
Install django-ses
In your djando settings.py file update the following info.
In your django file where you want to send an email