+import logging, logging.handlers, os, time, queue, threading, subprocess
+import traceback, smtplib
+import email.mime.text, email.utils
+
+# Logging configuration
+syslogLevel = logging.INFO
+mailLevel = logging.CRITICAL # must be "larger" than syslog level!
+mailAddress = ['post+tuer'+'@'+'ralfj.de', 'vorstand@lists.hacksaar.de']
+printLevel = logging.DEBUG
+
+# Mail logging handler
+def sendeMail(subject, text, receivers, sender='sphinx@hacksaar.de', replyTo=None):
+ assert isinstance(receivers, list)
+ if not len(receivers): return # nothing to do
+ # construct content
+ msg = email.mime.text.MIMEText(text.encode('UTF-8'), 'plain', 'UTF-8')
+ msg['Subject'] = subject
+ msg['Date'] = email.utils.formatdate(localtime=True)
+ msg['From'] = sender
+ msg['To'] = ', '.join(receivers)
+ if replyTo is not None:
+ msg['Reply-To'] = replyTo
+ # put into envelope and send
+ s = smtplib.SMTP('localhost')
+ s.sendmail(sender, receivers, msg.as_string())
+ s.quit()