diff options
-rw-r--r-- | user-profiles/feeds/imm-notmuch-insert.py | 8 |
1 files changed, 5 insertions, 3 deletions
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(): | |||
25 | else: | 25 | else: |
26 | msg['From'] = f"{callbackMessage['feed_definition']['title']} <imm@imm.invalid>" | 26 | msg['From'] = f"{callbackMessage['feed_definition']['title']} <imm@imm.invalid>" |
27 | msg['To'] = f"{notmuchConfig['user']['name']} <{notmuchConfig['user']['primary_email']}>" | 27 | msg['To'] = f"{notmuchConfig['user']['name']} <{notmuchConfig['user']['primary_email']}>" |
28 | msg['Subject'] = callbackMessage['feed_item']['title'] | 28 | if 'title' in callbackMessage['feed_item'] and callbackMessage['feed_item']['title']: |
29 | msg['Subject'] = callbackMessage['feed_item']['title'] | ||
29 | msg['Item-Identifier'] = f"{callbackMessage['feed_item']['identifier']}" | 30 | msg['Item-Identifier'] = f"{callbackMessage['feed_item']['identifier']}" |
30 | for link in callbackMessage['feed_item']['links']: | 31 | for link in callbackMessage['feed_item']['links']: |
31 | msg.add_header('Link', link['uri']) | 32 | msg.add_header('Link', link['uri']) |
@@ -36,8 +37,9 @@ def main(): | |||
36 | date = datetime.now(tzlocal()) | 37 | date = datetime.now(tzlocal()) |
37 | msg['Date'] = date.strftime('%a, %e %b %Y %T %z') | 38 | msg['Date'] = date.strftime('%a, %e %b %Y %T %z') |
38 | 39 | ||
39 | msg.set_content(html2text(callbackMessage['feed_item']['content'])) | 40 | if 'content' in callbackMessage['feed_item'] and callbackMessage['feed_item']['content']: |
40 | msg.add_alternative(callbackMessage['feed_item']['content'], subtype='html') | 41 | msg.set_content(html2text(callbackMessage['feed_item']['content'])) |
42 | msg.add_alternative(callbackMessage['feed_item']['content'], subtype='html') | ||
41 | 43 | ||
42 | 44 | ||
43 | subprocess.run( | 45 | subprocess.run( |