fixed mail encoding
This commit is contained in:
parent
ceaedd26a8
commit
46e163864a
@ -141,11 +141,12 @@ class Entry(Base):
|
|||||||
|
|
||||||
|
|
||||||
def send_mail(sender, receiver, subject, body):
|
def send_mail(sender, receiver, subject, body):
|
||||||
print 'sending to %s: %s' % (receiver.decode('latin-1'), subject.decode('latin-1'))
|
subject = subject.decode('latin-1')
|
||||||
mail = MIMEText(body)
|
print 'sending to %s: %s' % (receiver.decode('latin-1'), subject)
|
||||||
|
mail = MIMEText(body, _charset='utf-8')
|
||||||
mail['From'] = sender
|
mail['From'] = sender
|
||||||
mail['To'] = receiver
|
mail['To'] = receiver
|
||||||
mail['Subject'] = subject.decode('latin-1')
|
mail['Subject'] = subject
|
||||||
mailserver = smtplib.SMTP('localhost')
|
mailserver = smtplib.SMTP('localhost')
|
||||||
mailserver.sendmail(sender, [receiver], mail.as_string())
|
mailserver.sendmail(sender, [receiver], mail.as_string())
|
||||||
mailserver.quit()
|
mailserver.quit()
|
||||||
@ -160,6 +161,7 @@ def get_entry_text(entry):
|
|||||||
text = entry.summary
|
text = entry.summary
|
||||||
else:
|
else:
|
||||||
text = 'no text, sorry'
|
text = 'no text, sorry'
|
||||||
|
text = text.decode('latin-1')
|
||||||
return text
|
return text
|
||||||
|
|
||||||
def mail_daily_digest(session, sender, receiver, prefix):
|
def mail_daily_digest(session, sender, receiver, prefix):
|
||||||
|
Loading…
Reference in New Issue
Block a user