Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- EMAIL_HOST ='smtp.gmail.com'
- EMAIL_PORT = 587
- EMAIL_HOST_USER = 'feedback@example.com'
- EMAIL_HOST_PASSWORD = 'XXX'
- EMAIL_USE_TLS = True
- subject, from_email, to = "hello", 'Support Team','to_user@gmail.com'
- text = "hello"
- html = "<strong>hello</strong>"
- msg = EmailMultiAlternatives(subject, text_content, from_email, [to])
- msg.attach_alternative(html_content, "text/html")
- msg.send(fail_silently=False,auth_user = 'support@example.me',auth_password = 'XXX')
- from django.core.mail import *
- msg = EmailMultiAlternatives(subject, text_content, from_email, [to])
- msg.attach_alternative(html_content, "text/html")
- #retrieve emailbackend from settings.py
- connection = get_connection()
- #change connection parameters
- connection.username='XXX'
- connection.password='XXX'
- connection.host='XXX'
- connection.send_messages([msg,])
- # dont forget to close connection
- connection.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement