notify: add X-AUR-Reason header to allow conveniently filtering emails

Because filtering by matching the sender && regular expressions on the
subject is awkward.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
This commit is contained in:
Eli Schwartz 2018-09-27 11:32:26 -04:00
parent 44af2b430f
commit e0d821352f
No known key found for this signature in database
GPG key ID: CEB167EFB5722BD6

View file

@ -63,6 +63,9 @@ class Notification:
sendmail = aurweb.config.get('notifications', 'sendmail')
sender = aurweb.config.get('notifications', 'sender')
reply_to = aurweb.config.get('notifications', 'reply-to')
reason = self.__class__.__name__
if reason.endswith('Notification'):
reason = reason[:-len('Notification')]
for recipient in self.get_recipients():
to, lang = recipient
@ -72,6 +75,7 @@ class Notification:
msg['From'] = sender
msg['Reply-to'] = reply_to
msg['To'] = to
msg['X-AUR-Reason'] = reason
for key, value in self.get_headers().items():
msg[key] = value