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
|
@ -48,9 +48,12 @@ def send_msg( mailsubject, messagefile, recipients = None ):
|
||||||
msg.attach(MIMEText(mailbody, 'plain'))
|
msg.attach(MIMEText(mailbody, 'plain'))
|
||||||
msg.attach(MIMEText(markdown.markdown(mailbody), 'html'))
|
msg.attach(MIMEText(markdown.markdown(mailbody), 'html'))
|
||||||
|
|
||||||
relay = ("127.0.0.1", 10028)
|
if 'relay' in cfg and 'host' in cfg['relay'] and 'port' in cfg['relay']:
|
||||||
smtp = smtplib.SMTP(relay[0], relay[1])
|
relay = (cfg['relay']['host'], int(cfg['relay']['port']))
|
||||||
smtp.sendmail( cfg['cron']['notification_email'], recipients, msg.as_string() )
|
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
|
# Read configuration from /etc/gpg-mailgate.conf
|
||||||
_cfg = RawConfigParser()
|
_cfg = RawConfigParser()
|
||||||
|
|
Loading…
Reference in New Issue