# PREREQUISITES # 1. install smtp library first # pip install django-smtp-ssl # 2. access free tier Amazon SES # 3. on email addresses, add 'verify a new email address' # 4. verify the request by clicking the link from the email # 5. under Amazon SES, click SMTP Settings # 6. click Create my SMTP Credentials # 7. You'll be forwarded to IAM, click 'Create' button located on the lower-right side of the screen # 8. Click show my SMTP Credentials, you may also save it # FILE: settings.py EMAIL_BACKEND = 'django_smtp_ssl.SSLEmailBackend' EMAIL_HOST = 'email-smtp.us-west-2.amazonaws.com' EMAIL_PORT = 465 #using the smtp credentials generated from above EMAIL_HOST_USER = 'smtp_username' EMAIL_HOST_PASSWORD = 'smpt_password' #doesn't matter if mail is under tls already EMAIL_USE_TLS = False # FILE: view.py, polls folder from django.http import HttpResponse from django.core.mail import send_mail def index(request): send_mail('test subject', 'test message', 'sender@example.com', ['recipient@example.com'], fail_silently=False) return HttpResponse("Hello, world. You're at the polls index.")
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question