From d28cf36ac7e0f5b2fb36e92e6e3d7a52b33cd482 Mon Sep 17 00:00:00 2001
From: Psych0meter <38450421+Psych0meter@users.noreply.github.com>
Date: Tue, 24 Dec 2024 07:40:28 +0100
Subject: [PATCH] Enforce SMTPUTF8 policy

---
 intelmq/bots/outputs/templated_smtp/output.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/intelmq/bots/outputs/templated_smtp/output.py b/intelmq/bots/outputs/templated_smtp/output.py
index 4548df6bbf..de8b3b83a9 100644
--- a/intelmq/bots/outputs/templated_smtp/output.py
+++ b/intelmq/bots/outputs/templated_smtp/output.py
@@ -94,6 +94,7 @@
 import ssl
 from typing import List, Optional
 from email.message import EmailMessage
+from email import policy
 try:
     from jinja2 import Template
 except:
@@ -190,7 +191,7 @@ def process(self):
             if self.smtp_authentication:
                 smtp.login(user=self.username, password=self.password)
 
-            msg = EmailMessage()
+            msg = EmailMessage(policy=policy.SMTPUTF8)
             msg['Subject'] = self.templates["subject"].render(event=event)
             msg['From'] = self.templates["from"].render(event=event)
             msg['To'] = self.templates["to"].render(event=event)