From 1d2ed5d8ab99fb7437d6ab8ea9a3cccdffbc08d6 Mon Sep 17 00:00:00 2001 From: hopeaktian Date: Wed, 12 Dec 2018 14:00:35 +0800 Subject: [PATCH] debug mail error on server --- app/controllers/writer.py | 6 ++++-- app/sm.py | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/controllers/writer.py b/app/controllers/writer.py index 2d65463..30c2771 100644 --- a/app/controllers/writer.py +++ b/app/controllers/writer.py @@ -87,12 +87,14 @@ def addurl(): urls = request.form.get("urls") emails = request.form.get("emails") leavemes = request.form.get("leavemessage") + leavemes = str(leavemes) + leavemes = leavemes.decode('utf-8') try: mail_admin(urls, emails, leavemes) except: flash(u"提交失败,请重试! -_-||", category="warning") - return render_template('addurl.html') + # return render_template('addurl.html') else: flash(u"提交成功啦,主人已经收到你的请求了哦! ^_^", category="success") - return render_template('addurl.html') + # return render_template('addurl.html') return render_template('addurl.html') diff --git a/app/sm.py b/app/sm.py index b63e769..bd971da 100644 --- a/app/sm.py +++ b/app/sm.py @@ -31,6 +31,7 @@ def send_mail(to_list,sub,content): return False def mail_admin(urls,email,mes): message = str(urls) + " " + str(email) + " " + str(mes) + message = message.decode("utf-8") for i in range(1): #发送1封,上面的列表是几个人,这个就填几 if send_mail(mailto_list,"互加友链请求",message): return 1