From a8c2f16e06e01a43b3b979e64441a8690f971406 Mon Sep 17 00:00:00 2001 From: Arash Date: Mon, 2 May 2022 15:55:57 -0400 Subject: [PATCH] filename for attached images --- superset/utils/core.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/superset/utils/core.py b/superset/utils/core.py index 68caf7872c95..5d29fed802bf 100644 --- a/superset/utils/core.py +++ b/superset/utils/core.py @@ -928,7 +928,9 @@ def send_email_smtp( # pylint: disable=invalid-name,too-many-arguments,too-many # Attach any inline images, which may be required for display in # HTML content (inline) for msgid, imgdata in (images or {}).items(): - image = MIMEImage(imgdata) + formatted_time = formatdate(localtime=True) + file_name = f"{subject} {formatted_time}" + image = MIMEImage(imgdata, name=file_name) image.add_header("Content-ID", "<%s>" % msgid) image.add_header("Content-Disposition", "inline") msg.attach(image)