Advertisement
Guest User

Untitled

a guest
Jan 26th, 2016
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. EMAIL_HOST ='smtp.gmail.com'
  2. EMAIL_PORT = 587
  3. EMAIL_HOST_USER = 'feedback@example.com'
  4. EMAIL_HOST_PASSWORD = 'XXX'
  5. EMAIL_USE_TLS = True
  6.  
  7. subject, from_email, to = "hello", 'Support Team','to_user@gmail.com'
  8. text = "hello"
  9. html = "<strong>hello</strong>"
  10. msg = EmailMultiAlternatives(subject, text_content, from_email, [to])
  11. msg.attach_alternative(html_content, "text/html")
  12. msg.send(fail_silently=False,auth_user = 'support@example.me',auth_password = 'XXX')
  13.  
  14. from django.core.mail import *
  15. msg = EmailMultiAlternatives(subject, text_content, from_email, [to])
  16. msg.attach_alternative(html_content, "text/html")
  17. #retrieve emailbackend from settings.py
  18. connection = get_connection()
  19. #change connection parameters
  20. connection.username='XXX'
  21. connection.password='XXX'
  22. connection.host='XXX'
  23. connection.send_messages([msg,])
  24. # dont forget to close connection
  25. connection.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement