Created
August 2, 2016 08:16
-
-
Save ragowthaman/f7315ddfe7c9c9abbba4b9a81d3c3037 to your computer and use it in GitHub Desktop.
Enable Django app with emailing (send_mail + gmail)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Email/gmail configuration | |
| # console.EmailBackend is to test the email on console in dev mode | |
| # comment next line to spit emails on console for testing (of course comment the line next to it) | |
| # EMAIL_BACKEND='django.core.mail.backends.console.EmailBackend' | |
| # smtp.EmailBackend is for the production server | |
| EMAIL_BACKEND='django.core.mail.backends.smtp.EmailBackend' | |
| EMAIL_HOST='smtp.gmail.com' | |
| EMAIL_PORT=587 | |
| EMAIL_HOST_USER='[email protected]' | |
| EMAIL_HOST_PASSWORD='password' | |
| EMAIL_USE_TLS=True | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # send an email | |
| recipient_list = ["[email protected]", "[email protected]"] | |
| email_message = "A new consultant got registered into vidhaikalam. First Name: %s <p> Last Name: %s \n Id: %s" % \ | |
| (consultant_obj.firstname, consultant_obj.lastname, consultant_obj.id) | |
| send_mail("New consultant registered!", email_message, settings.DEFAULT_FROM_EMAIL, | |
| recipient_list, fail_silently=False, auth_user=None, | |
| auth_password=None, connection=None, html_message=None) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment