wrap text of digest-messages
This commit is contained in:
parent
a9e5a27627
commit
6145a040d2
@ -18,6 +18,7 @@ import ConfigParser
|
|||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
from email.header import Header
|
from email.header import Header
|
||||||
import smtplib
|
import smtplib
|
||||||
|
import textwrap
|
||||||
|
|
||||||
def send_mail(sender, receiver, subject, body):
|
def send_mail(sender, receiver, subject, body):
|
||||||
print 'sending to %s: %s' % (receiver[0], subject)
|
print 'sending to %s: %s' % (receiver[0], subject)
|
||||||
@ -54,10 +55,12 @@ def mail_daily_digest(session, sender, receiver, prefix):
|
|||||||
link = entry.link
|
link = entry.link
|
||||||
if entry.resolvedlink:
|
if entry.resolvedlink:
|
||||||
link = entry.resolvedlink
|
link = entry.resolvedlink
|
||||||
|
text = truncate_text(entry.get_text(), 250)
|
||||||
|
text = textwrap.fill(text, 78)
|
||||||
try:
|
try:
|
||||||
body = body + '=> %s - %s\n' % (entry.firstfetched.strftime('%y%m%d-%H%M'), feedinfo.title)
|
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' % entry.title
|
||||||
body = body + '%s\n' % truncate_text(entry.get_text(), 250)
|
body = body + '%s\n' % text
|
||||||
body = body + '%s\n\n' % link
|
body = body + '%s\n\n' % link
|
||||||
except:
|
except:
|
||||||
print 'ERROR processing entry %s' % entry.id;
|
print 'ERROR processing entry %s' % entry.id;
|
||||||
|
Loading…
Reference in New Issue
Block a user