Commit 5bab3707 authored by Colomban Wendling's avatar Colomban Wendling

Set In-Reply-To mail header for check followups

This allows mail clients to know to what message the followup is for,
making it easy for an user to see what relates to what when there are
several checks.
parent 37e8b0c8
import smtplib
from email.mime.text import MIMEText
from email.utils import make_msgid
from collections import defaultdict
from sys import stderr
from time import strftime
......@@ -88,6 +89,14 @@ def send_email_for_check(check):
# encode / decode is a fix that didn't make it into Debian Wheezy
msg = MIMEText(msg_text.encode('utf-8').decode('latin1'), 'plain', 'utf-8')
msg['Message-ID'] = make_msgid(type(check).__name__)
# if check is OK it's a follow up, so set In-Reply-To
if check.ok and hasattr(check, 'mails_msgid'):
msg['In-Reply-To'] = check.mails_msgid
msg['References'] = check.mails_msgid
check.mails_msgid = msg['Message-ID']
msg['Subject'] = subject
msg['From'] = config.emails.addr_from
msg['To'] = ", ".join(
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