From: Arnaud Delcasse Date: Sat, 18 Aug 2012 16:51:23 +0000 (+0200) Subject: Fix issue when generating email (unicode decoding) X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/%40%20%27icone_supprimer_signature%27%20=%3E%20%27Delete%20this%20signature%27%2C%20%27icone_valider_signature%27%20=%3E%20%27Validate%20this%20signature%27%2C%20%27image_administrer_rubrique%27%20=%3E%20%27You%20can%20manage%20this%20section%27%2C-%27impossible_modifier_login_auteur%27%20=%3E%20%27Login%20cannot%20be%20changed.%27%2C-%27impossible_modifier_pass_auteur%27%20=%3E%20%27Password%20cannot%20be%20changed.%27%2C%20%27info_1_article%27%20=%3E%20%271%20article%27%2C-%27info_1_article_syndique%27%20=%3E%20%271%20syndicated%20article%27%2C%20%27info_1_auteur%27%20=%3E%20%271%20author%27%2C%20%27info_1_message%27%20=%3E%20%271%20message%27%2C%20%27info_1_mot_cle%27%20=%3E%20%271%20keyword%27%2C%20%27info_1_rubrique%27%20=%3E%20%271%20section%27%2C-%27info_1_site%27%20=%3E%20%271%20site%27%2C%20%27info_1_visiteur%27%20=%3E%20%271%20visitor%27%2C%20%27info_activer_cookie%27%20=%3E%20%27You%20can%20activate%20an%20%3Cb%3Eadministration%20cookie%3C/b%3E%2C%20which%20allows%20you%20%20to%20switch%20easily%20between%20the%20public%20site%20and%20the%20private%20area.%27%2C%20%27info_activer_menu_developpement%27%20=%3E%20%27Show%20the%20Development%20menu%27%2C%20%27info_admin_etre_webmestre%27%20=%3E%20%27Give%20me%20web%20administrator%20rights%27%2C-%27info_admin_gere_rubriques%27%20=%3E%20%27This%20administrator%20manages%20the%20following%20sections:%27%2C-%27info_admin_gere_toutes_rubriques%27%20=%3E%20%27This%20administrator%20manages%20%3Cb%3Eall%20the%20sections%3C/b%3E.%27%2C-%27info_admin_gere_toutes_rubriques_2%27%20=%3E%20%27I%20manage%20%3Cb%3Eall%20the%20sections%3C/b%3E%27%2C%20%27info_admin_je_suis_webmestre%27%20=%3E%20%27I%20am%20a%20%3Cb%3Ewebmaster%3C/b%3E%27%2C%20%27info_admin_statuer_webmestre%27%20=%3E%20%27Give%20webmaster%20rights%20to%20this%20administrator%20%27%2C%20%27info_admin_webmestre%27%20=%3E%20%27This%20administrator%20is%20%3Cb%3Ewebmaster%3C/%7B%7B%20url_for%28%27show_vote%27%2C%20idvote=vote.id%29%20%7D%7D?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()