Browse Source

Make the SMTP relay used by cron configurable via config. Use the same as the gateway does.

pull/33/head
fkrone 7 years ago
parent
commit
d3bbb82072
  1. 9
      gpg-mailgate-web/cron.py

9
gpg-mailgate-web/cron.py

@ -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…
Cancel
Save