fixed mail encoding

This commit is contained in:
Ronald Schaten 2013-03-20 22:11:26 +01:00
parent ceaedd26a8
commit 46e163864a

View File

@ -141,11 +141,12 @@ class Entry(Base):
def send_mail(sender, receiver, subject, body):
print 'sending to %s: %s' % (receiver.decode('latin-1'), subject.decode('latin-1'))
mail = MIMEText(body)
subject = subject.decode('latin-1')
print 'sending to %s: %s' % (receiver.decode('latin-1'), subject)
mail = MIMEText(body, _charset='utf-8')
mail['From'] = sender
mail['To'] = receiver
mail['Subject'] = subject.decode('latin-1')
mail['Subject'] = subject
mailserver = smtplib.SMTP('localhost')
mailserver.sendmail(sender, [receiver], mail.as_string())
mailserver.quit()
@ -160,6 +161,7 @@ def get_entry_text(entry):
text = entry.summary
else:
text = 'no text, sorry'
text = text.decode('latin-1')
return text
def mail_daily_digest(session, sender, receiver, prefix):