test.py 880 B

1234567891011121314151617181920212223242526272829303132
  1. import emails
  2. from emails.template import JinjaTemplate
  3. # message = emails.Message(
  4. # subject=JinjaTemplate(subject_template),
  5. # html=JinjaTemplate(html_template),
  6. # mail_from=(settings.EMAILS_FROM_NAME, settings.EMAILS_FROM_EMAIL),
  7. # )
  8. message = f"test"
  9. subject = '註冊信'
  10. email_to ='doris@choozmo.com'
  11. # print('EEmail',email_to)
  12. message = emails.Message(
  13. subject=JinjaTemplate(message),
  14. html=JinjaTemplate(subject),
  15. mail_from=('zooey','zooey@choozmo.com'),
  16. )
  17. smtp_options = {"host": "smtp.gmail.com", "port": "587"}
  18. smtp_options["tls"] = True
  19. #smtp_options["ssl"] = True
  20. smtp_options["user"] = 'zooey@choozmo.com'
  21. smtp_options["password"] = 'bnufmjzkyezputip'
  22. environment={}
  23. print(email_to,environment,smtp_options)
  24. response = message.send(to=email_to, render=environment, smtp=smtp_options)
  25. print('RResponse',response)