Your Name há 3 anos atrás
pai
commit
513dc3eeb2
1 ficheiros alterados com 6 adições e 1 exclusões
  1. 6 1
      step_question/apis/main.py

+ 6 - 1
step_question/apis/main.py

@@ -30,13 +30,15 @@ app.add_middleware(
 
 
 def get_db():
-    db = dataset.connect('mysql://choozmo:pAssw0rd@139.162.121.30:33306/hhh?charset=utf8mb4')
+#    db = dataset.connect('mysql://choozmo:pAssw0rd@139.162.121.30:33306/hhh?charset=utf8mb4')
+    db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:33306/hhh?charset=utf8mb4')
     step_questions_table = db['step_questions']
     return step_questions_table
 
 
 
 def mail_to_user(umail):
+    print('mail_to_user')
     gmail_user = 'edm@choozmo.com'
     gmail_password='wqdsyqwvppmubitv'
     sent_from = gmail_user
@@ -49,6 +51,7 @@ def mail_to_user(umail):
     msg['Subject'] = '幸福空間五萬裝修折價券'
     msg['From'] = 'edm@choozmo.com'
     msg['To'] = 'jeweiliang@gmail.com'
+    print('MIMEMultipart')
 
     text = MIMEText("感謝您填寫問卷,敬送您五萬元裝修折價券。")
     msg.attach(text)
@@ -56,6 +59,8 @@ def mail_to_user(umail):
     msg.attach(image)
 
     try:
+        print('begin...')
+
         server = smtplib.SMTP_SSL('smtp.gmail.com', 465)
         server.ehlo()
         server.login(gmail_user, gmail_password)