summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMagnus Hagander2021-01-17 15:08:00 +0000
committerMagnus Hagander2021-01-17 15:08:00 +0000
commit5c1d75010306a8b3b9060cca1e2e750143b4b975 (patch)
tree762b10cd04c2f98170061d3b571f65fa896f0968
parent4f9fe484c102e1b8f10d69bd20a98ffb20222d6f (diff)
Set proper mail headers to indicate auto-generated mails
-rw-r--r--hamnadmin/hamnadmin/mailqueue/util.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/hamnadmin/hamnadmin/mailqueue/util.py b/hamnadmin/hamnadmin/mailqueue/util.py
index 1e39dd8..1bdca7f 100644
--- a/hamnadmin/hamnadmin/mailqueue/util.py
+++ b/hamnadmin/hamnadmin/mailqueue/util.py
@@ -14,7 +14,7 @@ def _encoded_email_header(name, email):
return email
-def send_simple_mail(sender, receiver, subject, msgtxt, attachments=None, bcc=None, sendername=None, receivername=None):
+def send_simple_mail(sender, receiver, subject, msgtxt, attachments=None, bcc=None, sendername=None, receivername=None, suppress_auto_replies=True):
# attachment format, each is a tuple of (name, mimetype,contents)
# content should be *binary* and not base64 encoded, since we need to
# use the base64 routines from the email library to get a properly
@@ -25,6 +25,10 @@ def send_simple_mail(sender, receiver, subject, msgtxt, attachments=None, bcc=No
msg['From'] = _encoded_email_header(sendername, sender)
msg['Date'] = formatdate(localtime=True)
+ if suppress_auto_replies:
+ msg['X-Auto-Response-Suppress'] = 'All'
+ msg['Auto-Submitted'] = 'auto-generated'
+
msg.attach(MIMEText(msgtxt, _charset='utf-8'))
if attachments: