From 6ca85fc961b7dde1208fafae88f078fee82d6c5f Mon Sep 17 00:00:00 2001
From: Thomas Schneider <thomas@fsmpi.rwth-aachen.de>
Date: Sat, 4 Mar 2017 22:34:58 +0100
Subject: [PATCH] Set Message-ID in outgoing mails

Signed-off-by: Thomas Schneider <thomas@fsmpi.rwth-aachen.de>
---
 utils.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/utils.py b/utils.py
index 88bc0ed..d68b72c 100644
--- a/utils.py
+++ b/utils.py
@@ -12,6 +12,8 @@ from datetime import datetime, date, timedelta
 import requests
 from io import BytesIO
 import ipaddress
+from socket import getfqdn
+from uuid import uuid4
 
 import config
 
@@ -81,6 +83,7 @@ class MailManager:
         msg["From"] = self.from_addr
         msg["To"] = to_addr
         msg["Subject"] = subject
+        msg["Message-ID"] = "{}@{}".format(uuid4(), getfqdn())
         msg.attach(MIMEText(content, _charset="utf-8"))
         if appendix is not None:
             for name, file_like in appendix:
-- 
GitLab