<reponame>mullerhai/etl_ml
import smtplib



if __name__ == '__main__':
  HOST = 'smtp.qq.com'

  # QQ邮箱的端口是465

  PORT = '465'

  TO='<EMAIL>'
  pwd='<PASSWORD>'
  FROM='<EMAIL>'
  SUBJECT='welcome to world'
  TEXT='today is friday ,we will get rest for two days '
  smtplib.SMTP()
  smtp_obj = smtplib.SMTP_SSL()
  smtp_obj.connect(host=HOST, port=PORT)
  result = smtp_obj.login(user=FROM, password=<PASSWORD>)
  print(result)
  message_content ='\n'.join(['From:%s'%FROM,'To:%s'%TO,'Subject:%s'%SUBJECT,'', TEXT])

  try:
    smtp_obj.sendmail(from_addr=FROM,to_addrs=[TO],msg=message_content)
    print("success")
  except Exception as  ex:
    print( "failed %s"%ex)
    raise



import smtplib



if __name__ == '__main__':
  HOST = 'smtp.qq.com'

  # QQ邮箱的端口是465

  PORT = '465'

  TO='<EMAIL>'
  pwd='<PASSWORD>'
  FROM='<EMAIL>'
  SUBJECT='welcome to world'
  TEXT='today is friday ,we will get rest for two days '
  smtplib.SMTP()
  smtp_obj = smtplib.SMTP_SSL()
  smtp_obj.connect(host=HOST, port=PORT)
  result = smtp_obj.login(user=FROM, password=<PASSWORD>)
  print(result)
  message_content ='\n'.join(['From:%s'%FROM,'To:%s'%TO,'Subject:%s'%SUBJECT,'', TEXT])

  try:
    smtp_obj.sendmail(from_addr=FROM,to_addrs=[TO],msg=message_content)
    print("success")
  except Exception as  ex:
    print( "failed %s"%ex)
    raise
# QQ邮箱的端口是465