mailer.py 931 B

123456789101112131415161718192021222324252627
  1. import smtplib
  2. import traceback
  3. import os
  4. from email.mime.text import MIMEText
  5. from email.mime.image import MIMEImage
  6. from email.mime.multipart import MIMEMultipart
  7. from email.message import EmailMessage
  8. import codecs
  9. gmail_user = 'ming@choozmo.com'
  10. gmail_password='lzpxinencaawsjus'
  11. sent_from = gmail_user
  12. #to = ['jared@choozmo.com','nina.huang@choozmo.com','ana@choozmo.com','ming@choozmo.com','mike@choozmo.com','andy@choozmo.com','hana@choozmo.com','stacy@choozmo.com','wen@choozmo.com','yukyo@choozmo.com','fxp87257@gmail.com','noodlesloves@gmail.com']
  13. to = ['ming013r@gmail.com']
  14. def send(msg):
  15. try:
  16. server = smtplib.SMTP_SSL('smtp.gmail.com', 465)
  17. server.ehlo()
  18. server.login(gmail_user, gmail_password)
  19. server.sendmail(sent_from, to, 'test mail')
  20. server.close()
  21. print ('Email sent!')
  22. except:
  23. traceback.print_exc()
  24. print ('Something went wrong...')