Commit bdaf57a1 authored by Ralf's avatar Ralf
Browse files

sphinx: don't crash when sending the mail fails

parent 94f0276a
import logging, logging.handlers, os, time, queue, threading, subprocess
import logging, logging.handlers, os, time, queue, threading, subprocess, socket
import traceback, smtplib
import email.mime.text, email.utils
from config import mailAddress, mailSender, mailServer
......@@ -22,9 +22,14 @@ def sendeMail(subject, text, receivers, sender=mailSender, replyTo=None):
if replyTo is not None:
msg['Reply-To'] = replyTo
# put into envelope and send
s = smtplib.SMTP(mailServer)
s.sendmail(sender, receivers, msg.as_string())
s.quit()
try:
s = smtplib.SMTP(mailServer)
s.sendmail(sender, receivers, msg.as_string())
s.quit()
except socket.gaierror as E:
# Don't use critical here, that would result in an endless loop...
logger.info("sendeMail: Could not send mail. THIS IS BAD! The mail is lost.")
return False
# logging function
class Logger:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment