123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- import smtplib
- import traceback
- import os
- from email.mime.text import MIMEText
- from email.mime.image import MIMEImage
- from email.mime.multipart import MIMEMultipart
- from email.message import EmailMessage
- import codecs
- gmail_user = 'ming@choozmo.com'
- gmail_password='lzpxinencaawsjus'
- 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']
- def send_left_not_enough(msg_in,email):
- to = [email]
- msg = MIMEMultipart()
- msg['Subject'] = 'AI Spokesgirl 服務餘額不足 '
-
- msgAlternative = MIMEMultipart('alternative')
- msg.attach(msgAlternative)
- text = MIMEText(msg_in,'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...')
- def register_verify(msg_in,email):
- to = [email]
- msg = MIMEMultipart()
- msg['Subject'] = '驗證您的信箱'
-
- msgAlternative = MIMEMultipart('alternative')
- msg.attach(msgAlternative)
- text = MIMEText(msg_in,'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()
- except:
- traceback.print_exc()
|