added smtp auth to cron.py
This commit is contained in:
parent
ea0e012c04
commit
86b725349f
|
@ -57,6 +57,13 @@ def send_msg( mailsubject, messagefile, recipients = None ):
|
|||
if 'relay' in cfg and 'host' in cfg['relay'] and 'enc_port' in cfg['relay']:
|
||||
relay = (cfg['relay']['host'], int(cfg['relay']['enc_port']))
|
||||
smtp = smtplib.SMTP(relay[0], relay[1])
|
||||
if 'smtp' in cfg and 'enabled' in cfg['smtp'] and cfg['smtp']['enabled'] == 'true':
|
||||
smtp.connect(cfg['smtp']['host'],cfg['smtp']['port'])
|
||||
smtp.ehlo()
|
||||
if cfg['smtp']['startls'] == 'true':
|
||||
smtp.starttls()
|
||||
smtp.ehlo()
|
||||
smtp.login(cfg['smtp']['username'], cfg['smtp']['password'])
|
||||
smtp.sendmail( cfg['cron']['notification_email'], recipients, msg.as_string() )
|
||||
else:
|
||||
appendLog("Could not send mail due to wrong configuration")
|
||||
|
|
|
@ -83,6 +83,15 @@ enc_port = 25
|
|||
# Set this option to yes to use TLS for SMTP Servers which require TLS.
|
||||
starttls = no
|
||||
|
||||
[smtp]
|
||||
# Options when smtp auth is required to send out emails
|
||||
enabled = false
|
||||
username = gpg-mailgate
|
||||
password = changeme
|
||||
host = yourdomain.tld
|
||||
port = 587
|
||||
starttls = true
|
||||
|
||||
[database]
|
||||
# uncomment the settings below if you want
|
||||
# to read keys from a gpg-mailgate-web database
|
||||
|
|
Loading…
Reference in New Issue