Skip to content

Commit

Permalink
filename for attached images (#19929)
Browse files Browse the repository at this point in the history
  • Loading branch information
AAfghahi authored May 5, 2022
1 parent 7b88ec7 commit 2e2053f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion superset/utils/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 2e2053f

Please sign in to comment.