| 1234567891011121314151617181920212223242526272829303132333435363738394041 | import smtplibimport tracebackimport osfrom email.mime.text import MIMETextfrom email.mime.image import MIMEImagefrom email.mime.multipart import MIMEMultipartfrom email.message import EmailMessageimport codecsgmail_user = 'edm@choozmo.com'gmail_password='wqdsyqwvppmubitv'sent_from = gmail_user#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']to = ['jared@choozmo.com']msg = MIMEMultipart()msg['Subject'] = '[2021-06-11] 趨勢日報 | ChoozMo 'msg['From'] = 'edm@choozmo.com'msg['To'] = 'jeweiliang@gmail.com'msgAlternative = MIMEMultipart('alternative')msg.attach(msgAlternative)fr=codecs.open('c:/tmp/final.html','r','utf-8')content=fr.read()fr.close()text = MIMEText(content,'html','utf-8')msgAlternative.attach(text)try:    server = smtplib.SMTP_SSL('smtp.gmail.com', 465)    server.ehlo()    server.login(gmail_user, gmail_password)    server.sendmail(sent_from, to,  msg.as_string())    server.close()    print ('Email sent!')except:    traceback.print_exc()    print ('Something went wrong...')
 |