aboutsummaryrefslogtreecommitdiffstats
path: root/climl/hooks.py
diff options
context:
space:
mode:
Diffstat (limited to 'climl/hooks.py')
-rw-r--r--climl/hooks.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/climl/hooks.py b/climl/hooks.py
index c4840fd..8311da4 100644
--- a/climl/hooks.py
+++ b/climl/hooks.py
@@ -1,3 +1,4 @@
+import smtplib
from . import interface
@@ -30,7 +31,15 @@ def hook_generate_rcpt_list(context, content):
def hook_send_all(context, content):
+ listaddress = context.get('listaddress', None)
+ if not listaddress:
+ raise interface.HookStopIteration('list address not found')
recipients = context.get('recipients', None)
if not recipients:
raise interface.HookStopIteration()
# TODO: how to send emails here ?
+
+ smtp_server = smtplib.SMTP(context.get('smtp.server'))
+ #smtp_server.set_debuglevel(1)
+ smtp_server.sendmail(listaddress, context['recipients'], content)
+ smtp_server.quit()