From 0a91fdcc6da28b7069e4af8c72cfdc1c0f597d3f Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 1 Nov 2022 09:02:11 -0700 Subject: [PATCH] fix junkmail logic --- custom_components/mail_and_packages/helpers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/custom_components/mail_and_packages/helpers.py b/custom_components/mail_and_packages/helpers.py index dc94accf..06bbe974 100644 --- a/custom_components/mail_and_packages/helpers.py +++ b/custom_components/mail_and_packages/helpers.py @@ -675,7 +675,8 @@ def get_mails( elif part.get_content_type() == "image/jpeg": _LOGGER.debug("Extracting image from email") filename = part.get_filename() - if ["mailer", "content"] in filename: + junkmail = ["mailer", "content"] + if any(junk in filename for junk in junkmail): _LOGGER.debug("Discarding junk mail.") continue try: