From bde8d615a722b4b8b3b19367e83953c9f9928588 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sun, 5 Sep 2021 14:25:00 +0200 Subject: feeds: ... --- user-profiles/feeds/imm-notmuch-insert.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'user-profiles/feeds') diff --git a/user-profiles/feeds/imm-notmuch-insert.py b/user-profiles/feeds/imm-notmuch-insert.py index ba29ce5b..b7eed292 100644 --- a/user-profiles/feeds/imm-notmuch-insert.py +++ b/user-profiles/feeds/imm-notmuch-insert.py @@ -25,7 +25,8 @@ def main(): else: msg['From'] = f"{callbackMessage['feed_definition']['title']} " msg['To'] = f"{notmuchConfig['user']['name']} <{notmuchConfig['user']['primary_email']}>" - msg['Subject'] = callbackMessage['feed_item']['title'] + if 'title' in callbackMessage['feed_item'] and callbackMessage['feed_item']['title']: + msg['Subject'] = callbackMessage['feed_item']['title'] msg['Item-Identifier'] = f"{callbackMessage['feed_item']['identifier']}" for link in callbackMessage['feed_item']['links']: msg.add_header('Link', link['uri']) @@ -36,8 +37,9 @@ def main(): date = datetime.now(tzlocal()) msg['Date'] = date.strftime('%a, %e %b %Y %T %z') - msg.set_content(html2text(callbackMessage['feed_item']['content'])) - msg.add_alternative(callbackMessage['feed_item']['content'], subtype='html') + if 'content' in callbackMessage['feed_item'] and callbackMessage['feed_item']['content']: + msg.set_content(html2text(callbackMessage['feed_item']['content'])) + msg.add_alternative(callbackMessage['feed_item']['content'], subtype='html') subprocess.run( -- cgit v1.2.3