Adding UTF8 codecs

This commit is contained in:
László Károlyi 2015-05-05 20:29:39 +02:00
parent a9593a25b8
commit 5c5e03edb6
1 changed files with 3 additions and 2 deletions

View File

@ -6,6 +6,7 @@ import smtplib
import sqlite3
import datetime
import syslog
import codecs
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
@ -79,10 +80,10 @@ msg['To'] = original_headers['From']
if original_headers['Message-Id']:
msg['References'] = original_headers['Message-Id']
with open('text-reply.txt') as fp:
with codecs.open('text-reply.txt', 'r', 'utf-8') as fp:
text_reply = fp.read()
with open('html-reply.html') as fp:
with codecs.open('html-reply.html', 'r', 'utf-8') as fp:
html_reply = fp.read()
part1 = MIMEText(text_reply, 'plain')