From 872bbba71cc6ed3bdd4c7d5d0e427259d3f24417 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Thu, 21 Jul 2022 15:22:20 +0200 Subject: [PATCH] Notifications - email - Correctly send plaintext notification email with plaintext header (#767) --- changedetectionio/notification.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/changedetectionio/notification.py b/changedetectionio/notification.py index de8d4cad..0e4b20b8 100644 --- a/changedetectionio/notification.py +++ b/changedetectionio/notification.py @@ -64,7 +64,7 @@ def process_notification(n_object, datastore): # So if no avatar_url is specified, add one so it can be correctly calculated into the total payload k = '?' if not '?' in url else '&' - if not 'avatar_url' in url: + if not 'avatar_url' in url and not url.startswith('mail'): url += k + 'avatar_url=https://raw.githubusercontent.com/dgtlmoon/changedetection.io/master/changedetectionio/static/images/avatar-256x256.png' if url.startswith('tgram://'): @@ -86,6 +86,13 @@ def process_notification(n_object, datastore): n_title = n_title[0:payload_max_size] n_body = n_body[0:body_limit] + elif url.startswith('mailto'): + # Apprise will default to HTML, so we need to override it + # So that whats' generated in n_body is in line with what is going to be sent. + # https://github.com/caronc/apprise/issues/633#issuecomment-1191449321 + if not 'format=' in url and (n_format == 'text' or n_format == 'markdown'): + url = "{}?format={}".format(url, n_format) + apobj.add(url) apobj.notify(