Make the SMTP relay used by cron configurable via config. Use the same as the gateway does.
This commit is contained in:
parent
efe2187bb5
commit
d3bbb82072
1 changed files with 6 additions and 3 deletions
|
@ -48,9 +48,12 @@ def send_msg( mailsubject, messagefile, recipients = None ):
|
|||
msg.attach(MIMEText(mailbody, 'plain'))
|
||||
msg.attach(MIMEText(markdown.markdown(mailbody), 'html'))
|
||||
|
||||
relay = ("127.0.0.1", 10028)
|
||||
smtp = smtplib.SMTP(relay[0], relay[1])
|
||||
smtp.sendmail( cfg['cron']['notification_email'], recipients, msg.as_string() )
|
||||
if 'relay' in cfg and 'host' in cfg['relay'] and 'port' in cfg['relay']:
|
||||
relay = (cfg['relay']['host'], int(cfg['relay']['port']))
|
||||
smtp = smtplib.SMTP(relay[0], relay[1])
|
||||
smtp.sendmail( cfg['cron']['notification_email'], recipients, msg.as_string() )
|
||||
else:
|
||||
appendLog("Could not send mail due to wrong configuration")
|
||||
|
||||
# Read configuration from /etc/gpg-mailgate.conf
|
||||
_cfg = RawConfigParser()
|
||||
|
|
Loading…
Reference in a new issue