From de9e465a93dde670ac6677f8b036e40d939cc84f Mon Sep 17 00:00:00 2001 From: "Cyprien Nicolas (fulax)" Date: Sun, 10 Feb 2013 17:50:22 +0100 Subject: [PATCH] Add Content-type header to mails. Charset is set to utf-8, as the body is utf-8 encoded --- main.py | 3 +++ reminder.py | 2 ++ 2 files changed, 5 insertions(+) diff --git a/main.py b/main.py index da8431c..f2db15b 100755 --- a/main.py +++ b/main.py @@ -150,6 +150,7 @@ def password_lost(): "To: %s" % user['email'], "Subject: [Cavote] %s" % gettext(u"Lost password"), "Date: %s" % time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime()).decode('utf-8'), + "Content-type: text/plain; charset=utf-8", "X-Mailer: %s" % VERSION, "", gettext(u"It seems that you have lost your password."), @@ -284,6 +285,7 @@ def admin_user_add(): "To: %s" % user['email'], "Subject: [Cavote] %s" % gettext(u"Welcome"), "Date: %s" % time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime()).decode('utf-8'), + "Content-type: text/plain; charset=utf-8", "X-Mailer: %s" % VERSION, "", "%(text)s %(user)s!" % {"text": gettext(u"Hi"), "user": user['name']}, @@ -608,6 +610,7 @@ def admin_vote_edit(voteid): "To: %s" % user['email'], "Subject: [Cavote] %s" % gettext(u"A vote has been opened for your group"), "Date: %s" % time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime()).decode('utf-8'), + "Content-type: text/plain; charset=utf-8", "X-Mailer: %s" % VERSION, "", "%(text)s %(title)s" % {"text": gettext(u"A vote has been opened and you are in a group concerned by it :"), "title": request.form['title']}, diff --git a/reminder.py b/reminder.py index 6ebac88..56cf4bc 100644 --- a/reminder.py +++ b/reminder.py @@ -42,6 +42,7 @@ for vote in c.execute('select id, id_group, date_end, title from votes where is_ "To: %s" % user[1], "Subject: [Cavote] %s" % gettext(u"Vote reminder - You didn't take part to it"), "Date: %s" % time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime()).decode('utf-8'), + "Content-type: text/plain; charset=utf-8", "X-Mailer: %s" % VERSION, "", "%s %s : %s" % (gettext(u"A vote concerns you and is going to terminate on"), vote[2], vote[3]), @@ -64,6 +65,7 @@ for vote in c.execute('select id, id_group, date_end, title from votes where is_ "To: %s" % user[1], "Subject: [Cavote] %s" % gettext(u"Vote reminder - Last days to modify your choice"), "Date: %s" % time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime()).decode('utf-8'), + "Content-type: text/plain; charset=utf-8", "X-Mailer: %s" % VERSION, "", "%s %s : %s" % (gettext(u"A vote concerns you and is going to terminate on "), vote[2], vote[3]), -- 2.20.1