def send(mailfrom, rcpttos, data): try: conf = ConfUtil.lib(__file__) smtp = SMTP(conf['host'], conf['port'], timeout=conf['timeout']) if conf['tls']: smtp.ehlo() smtp.starttls() smtp.ehlo() if conf['username'] != '': smtp.login(conf['username'], conf['password']) smtp.sendmail(mailfrom, rcpttos, data) try: smtp.quit() except Exception: pass return True except (SMTPException, error, timeout): return False
def __init__(self, daemon): self.conf = ConfUtil.lib(__file__) self.daemon = daemon self.dirname = sep + path.join('var', 'log', 'zen')