Sending emails with Django its quite easy, you just need to edit your project settings.py and add:
#SMTP Server configuration EMAIL_HOST = 'smtp.gmail.com' EMAIL_HOST_USER = '[email protected]' EMAIL_HOST_PASSWORD = 'your_password' EMAIL_PORT = 587 EMAIL_USE_TLS = True then save it and open a python terminal by running: >>> from django.core.mail import send_mail >>>send_mail('Django mail', 'This e-mail was sent with Django' , '[email protected]', ['[email protected]'], fail_silently =False) after if you get back "1" everything went ok. You May need to enable access for less secured apps at https://www.google.com/settings/security/lesssecureapps. |
Archives
August 2018
Categories |