Added starttls support for SMTP
This commit is contained in:
parent
29f902b27c
commit
0b92307b23
|
@ -80,6 +80,9 @@ port = 10028
|
||||||
# mails through the GPG-Mailgate so they are encrypted
|
# mails through the GPG-Mailgate so they are encrypted
|
||||||
enc_port = 25
|
enc_port = 25
|
||||||
|
|
||||||
|
# Set this option to yes to use TLS for SMTP Servers which require TLS.
|
||||||
|
starttls = no
|
||||||
|
|
||||||
[database]
|
[database]
|
||||||
# uncomment the settings below if you want
|
# uncomment the settings below if you want
|
||||||
# to read keys from a gpg-mailgate-web database
|
# to read keys from a gpg-mailgate-web database
|
||||||
|
|
|
@ -627,6 +627,8 @@ def send_msg( message, recipients ):
|
||||||
log("Sending email to: <%s>" % '> <'.join( recipients ))
|
log("Sending email to: <%s>" % '> <'.join( recipients ))
|
||||||
relay = (cfg['relay']['host'], int(cfg['relay']['port']))
|
relay = (cfg['relay']['host'], int(cfg['relay']['port']))
|
||||||
smtp = smtplib.SMTP(relay[0], relay[1])
|
smtp = smtplib.SMTP(relay[0], relay[1])
|
||||||
|
if cfg.has_key('relay') and cfg['relay'].has_key('starttls') and cfg['relay']['starttls'] == 'yes':
|
||||||
|
smtp.starttls()
|
||||||
smtp.sendmail( from_addr, recipients, message )
|
smtp.sendmail( from_addr, recipients, message )
|
||||||
else:
|
else:
|
||||||
log("No recipient found")
|
log("No recipient found")
|
||||||
|
|
Loading…
Reference in New Issue