Commit 37e8b0c8 authored by Colomban Wendling's avatar Colomban Wendling

Add Date field in sent emails

Some emails client don't know the date if this field is not present,
and although some MTAs add it it can't be relied upon.
parent 5590a3e9
...@@ -2,6 +2,7 @@ import smtplib ...@@ -2,6 +2,7 @@ import smtplib
from email.mime.text import MIMEText from email.mime.text import MIMEText
from collections import defaultdict from collections import defaultdict
from sys import stderr from sys import stderr
from time import strftime
import email.charset import email.charset
from threading import Thread from threading import Thread
import queue import queue
...@@ -90,6 +91,7 @@ def send_email_for_check(check): ...@@ -90,6 +91,7 @@ def send_email_for_check(check):
msg['Subject'] = subject msg['Subject'] = subject
msg['From'] = config.emails.addr_from msg['From'] = config.emails.addr_from
msg['To'] = ", ".join(config.emails.to) msg['To'] = ", ".join(config.emails.to)
msg['Date'] = strftime('%a, %d %b %Y %H:%M:%S %z')
_mailer.sendmail(config.emails.addr_from, config.emails.to, _mailer.sendmail(config.emails.addr_from, config.emails.to,
msg.as_string()) msg.as_string())
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment