wrap text of digest-messages

This commit is contained in:
Ronald Schaten 2013-04-05 23:03:51 +02:00
parent a9e5a27627
commit 6145a040d2

View File

@ -18,6 +18,7 @@ import ConfigParser
from argparse import ArgumentParser
from email.header import Header
import smtplib
import textwrap
def send_mail(sender, receiver, subject, body):
print 'sending to %s: %s' % (receiver[0], subject)
@ -54,10 +55,12 @@ def mail_daily_digest(session, sender, receiver, prefix):
link = entry.link
if entry.resolvedlink:
link = entry.resolvedlink
text = truncate_text(entry.get_text(), 250)
text = textwrap.fill(text, 78)
try:
body = body + '=> %s - %s\n' % (entry.firstfetched.strftime('%y%m%d-%H%M'), feedinfo.title)
body = body + '>> %s\n' % entry.title
body = body + '%s\n' % truncate_text(entry.get_text(), 250)
body = body + '%s\n' % text
body = body + '%s\n\n' % link
except:
print 'ERROR processing entry %s' % entry.id;