diff options
author | Mark Powers <mark@marks.kitchen> | 2020-09-20 02:09:44 +0000 |
---|---|---|
committer | Mark Powers <mark@marks.kitchen> | 2020-09-20 02:09:44 +0000 |
commit | 3f2e142d2c9b1e46faee988111abaffea946ce6a (patch) | |
tree | 20f108ee588080cf1ca853cda119e8f3a5644c13 /daily-update.py | |
parent | b4441232cb2c54e7ab0173a09640eff3828017cd (diff) |
Add imap to email_helper, add reminders in daily-update
Diffstat (limited to 'daily-update.py')
-rwxr-xr-x | daily-update.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/daily-update.py b/daily-update.py index 7109b99..aa30efe 100755 --- a/daily-update.py +++ b/daily-update.py @@ -33,9 +33,21 @@ def get_old_news(): news_text += '<a href="%s">%s %s</a>\n' % (full, name, century_ago) return news_text +def get_unread_reminders(): + print("getting unread reminders") + subjects = email_helper.filter_unread("subject", "REMINDER:", "subject") + subjects = [s[len("REMINDER: "):].strip() for s in subjects] + if len(subjects) > 0: + reminder_html = "<h1>Reminders:</h1><ul>" + for s in subjects: + reminder_html += "<li>%s</li>" % s + reminder_html += "</ul>\n" + return reminder_html + return "" + def format_email(): print("forming email") - return '%s%s' % (get_old_news(), get_weather()) + return '%s%s%s' % (get_unread_reminders(), get_old_news(), get_weather()) def send_update_email(): frm = config["email"]["user"] |