diff options
author | VG <vg@devys.org> | 2016-06-10 23:27:11 +0200 |
---|---|---|
committer | VG <vg@devys.org> | 2016-06-10 23:27:11 +0200 |
commit | 232e7d95f0f2d0b00c6476ac89d3f93691ba7b47 (patch) | |
tree | aec32f6a4d2415a42285304ea379fb4af9b38205 /climl/hooks.py | |
parent | 6e62cf116d561dcb8c7b72c9c5165db97706fec8 (diff) | |
download | climl-232e7d95f0f2d0b00c6476ac89d3f93691ba7b47.tar.gz climl-232e7d95f0f2d0b00c6476ac89d3f93691ba7b47.tar.bz2 climl-232e7d95f0f2d0b00c6476ac89d3f93691ba7b47.zip |
simplify exception display, fix rcpt filename
Diffstat (limited to 'climl/hooks.py')
-rw-r--r-- | climl/hooks.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/climl/hooks.py b/climl/hooks.py index a521376..e4a0a8e 100644 --- a/climl/hooks.py +++ b/climl/hooks.py @@ -5,10 +5,10 @@ from . import interface def hook_extract_listname(context): lines = context['content'].split(b'\n') for line in lines: - print('line: ', line) if line.startswith(b'Delivered-To: '): listname = line.split()[1].decode('ascii') - context['listname'] = listname + context['listname'] = listname.split('@')[0] + context['listaddress'] = listname print('found listname: {}'.format(listname)) return raise interface.HookAbortError('listname not found') @@ -30,7 +30,7 @@ def hook_generate_rcpt_list(context): listname = context.get('listname', None) if not listname: raise interface.HookStopIteration('list name not found') - recipients_filename = ''.join([listname, '-recipents.txt']) + recipients_filename = ''.join([listname, '-recipients.txt']) try: with open(recipients_filename, encoding='utf8') as fi: recipients = [recipient for recipient in fi] @@ -51,7 +51,7 @@ def hook_send_all(context): raise interface.HookStopIteration() # TODO: how to send emails here ? - smtp_server = smtplib.SMTP(context.conf.get('smtp.server')) + smtp_server = smtplib.SMTP(context['conf']['smtp.server']) #smtp_server.set_debuglevel(1) smtp_server.sendmail(listaddress, context['recipients'], |