From 9a0814e7bcf5aba1289f4bcbf09043a69dd03c5a Mon Sep 17 00:00:00 2001 From: Arnaud Delcasse Date: Sat, 18 Aug 2012 18:51:23 +0200 Subject: [PATCH] Fix issue when generating email (unicode decoding) --- main.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index 956e438..3fcc5ae 100755 --- a/main.py +++ b/main.py @@ -124,7 +124,7 @@ def password_lost(): "From: %s" % EMAIL, "To: %s" % user['email'], "Subject: [Cavote] Password lost", - "Date: %s" % time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime()), + "Date: %s" % time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime()).decode('utf-8'), "X-Mailer: %s" % VERSION, "", "You have lost your password.", @@ -135,7 +135,7 @@ def password_lost(): link, "", "If you think this mail is not for you, please ignore and delete it." - ), "\r\n") + ), "\n") server = smtplib.SMTP(SMTP_SERVER) server.sendmail(EMAIL, [user['email']], BODY) server.quit() @@ -254,7 +254,7 @@ def admin_user_add(): "From: %s" % EMAIL, "To: %s" % user['email'], "Subject: [Cavote] Welcome", - "Date: %s" % time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime()), + "Date: %s" % time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime()).decode('utf-8'), "X-Mailer: %s" % VERSION, "", "Hi %s!" % user['name'], @@ -264,7 +264,7 @@ def admin_user_add(): "To log in for the first time and set your password, please follow this link :", link, "" - ), "\r\n") + ), "\n") server = smtplib.SMTP(SMTP_SERVER) server.sendmail(EMAIL, [user['email']], BODY) server.quit() -- 2.20.1