diff --git a/authentik/stages/email/tasks.py b/authentik/stages/email/tasks.py index 92fc34dd2c..b4b6ba03b5 100644 --- a/authentik/stages/email/tasks.py +++ b/authentik/stages/email/tasks.py @@ -100,9 +100,11 @@ def send_mail( # Because we use the Message-ID as UID for the task, manually assign it message_object.extra_headers["Message-ID"] = message_id - # Add the logo (we can't add it in the previous message since MIMEImage - # can't be converted to json) - message_object.attach(logo_data()) + # Add the logo if it is used in the email body (we can't add it in the + # previous message since MIMEImage can't be converted to json) + body = get_email_body(message_object) + if "cid:logo" in body: + message_object.attach(logo_data()) if ( message_object.to diff --git a/authentik/stages/email/templates/email/base.html b/authentik/stages/email/templates/email/base.html index 08a60107a0..98f9e448cc 100644 --- a/authentik/stages/email/templates/email/base.html +++ b/authentik/stages/email/templates/email/base.html @@ -96,7 +96,7 @@ {% block content %} diff --git a/authentik/stages/email/utils.py b/authentik/stages/email/utils.py index f19d9c1ea6..4ca986045a 100644 --- a/authentik/stages/email/utils.py +++ b/authentik/stages/email/utils.py @@ -19,7 +19,8 @@ def logo_data() -> MIMEImage: path = Path("web/dist/assets/icons/icon_left_brand.png") with open(path, "rb") as _logo_file: logo = MIMEImage(_logo_file.read()) - logo.add_header("Content-ID", "logo.png") + logo.add_header("Content-ID", "") + logo.add_header("Content-Disposition", "inline", filename="logo.png") return logo diff --git a/web/src/components/ak-event-info.ts b/web/src/components/ak-event-info.ts index 23847ba8bc..3a6346e2a2 100644 --- a/web/src/components/ak-event-info.ts +++ b/web/src/components/ak-event-info.ts @@ -374,7 +374,7 @@ ${JSON.stringify(value.new_value, null, 4)}${msg("Email info:")}
${this.getEmailInfo(this.event.context)}
- +