From: Arnaud Delcasse Date: Sat, 18 Aug 2012 16:51:23 +0000 (+0200) Subject: Fix issue when generating email (unicode decoding) X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/%24wgScriptPath/%40%20%27entree_login%27%20=%3E%20%27Your%20login%27%2C%20%27entree_login_connexion_1%27%20=%3E%20%27Connection%20login%27%2C%20%27entree_login_connexion_2%27%20=%3E%20%27%28Sometimes%20matches%20your%20FTP%20account%20login%20and%20sometimes%20left%20empty%29%27%2C-%27entree_login_ldap%27%20=%3E%20%27Initial%20LDAP%20login%27%2C%20%27entree_mot_passe%27%20=%3E%20%27Your%20password%27%2C%20%27entree_mot_passe_1%27%20=%3E%20%27Password%27%2C%20%27entree_mot_passe_2%27%20=%3E%20%27%28Sometimes%20matches%20your%20FTP%20access%20password%20and%20sometimes%20left%20empty%29%27%2C%40%40%20-150%2C7%20%20121%2C7%20%40%40%20Do%20not%20submit%20this%20import%20request.%3Cp%3EFor%20more%20information%2C%20please%20see%20%3Ca%20href=?a=commitdiff_plain;h=9a0814e7bcf5aba1289f4bcbf09043a69dd03c5a;p=cavote.git Fix issue when generating email (unicode decoding) --- 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()