From: Magnus Hagander Date: Sun, 17 Jan 2021 15:08:00 +0000 (+0100) Subject: Set proper mail headers to indicate auto-generated mails X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=5c1d75010306a8b3b9060cca1e2e750143b4b975;p=hamn.git Set proper mail headers to indicate auto-generated mails --- 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: