Updating syslog, adding references sending

This commit is contained in:
László Károlyi 2015-05-05 20:26:06 +02:00
parent 1d96f39ce1
commit a9593a25b8
2 changed files with 12 additions and 8 deletions

View file

@ -6,11 +6,11 @@
don't give a flying fuck?
- Did you already set up a vacation autoresponse but they use lists and your
emails get delivered to the list response (/dev/null most of the time)?
- Did you get a fuckton of recurring inquiries?
- Did you get a fuckton of recurring irrelevant inquiries?
Then this is for you. If you set up your email server to pipe the email into
this tool after filtering for the addresses (used with dovecot2/sieve filters),
it will send replies to the `From` header, not the `Return-Path` one.
Then this is for you. If you set up your email server to pipe the email body
into this tool after filtering for the addresses (used with dovecot2/sieve
filters), it will send replies to the `From` header, not the `Return-Path` one.
Am I a dick for implementing this? No more than the recruiters unwilling to
update their filters/mailing lists.
@ -26,10 +26,8 @@ Used python3 modules:
## Requirements:
A mailserver.
Pretty much nothing else than `python3`. Modules come shipped.
- A mailserver.
- Sqlite and its python bindings.
- `text-reply.txt` containing the text version of your reply
- `html-reply.html` containing the html version of your reply

View file

@ -46,6 +46,10 @@ if len(rows):
if last_used_ts >= one_day_before:
cursor.close()
conn.close()
syslog.syslog(
'Not sending recruiter autoreply to %s, last sent at %s' % (
original_headers['From'], last_used_ts)
)
sys.exit(0)
if len(rows) == 0:
@ -72,6 +76,8 @@ msg = MIMEMultipart('alternative')
msg['Subject'] = 'Re: %s' % original_headers['Subject']
msg['From'] = original_headers['To']
msg['To'] = original_headers['From']
if original_headers['Message-Id']:
msg['References'] = original_headers['Message-Id']
with open('text-reply.txt') as fp:
text_reply = fp.read()