Skip to content

Commit

Permalink
filename for attached images (apache#19929)
Browse files Browse the repository at this point in the history
  • Loading branch information
AAfghahi authored and philipher29 committed Jun 9, 2022
1 parent 6aa8c6a commit d91187b
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 d91187b

Please sign in to comment.