Add SMTP TLS support
This commit is contained in:
1 parent
9a37017f1a
commit
63c95d7ac0
3 files changed
+5
No files matched your search
@@ -26,6 +26,7 @@ scheduler.
|
|||||||
## Changelog
|
## Changelog
|
||||||
### Unreleased
|
### Unreleased
|
||||||
* Add support for running `snapraid touch` (by ShoGinn, PR-11)
|
* Add support for running `snapraid touch` (by ShoGinn, PR-11)
|
||||||
|
* Add SMTP TLS support
|
||||||
|
|
||||||
### v0.3 (20 Jul 2017)
|
### v0.3 (20 Jul 2017)
|
||||||
* Limit size of sent emails
|
* Limit size of sent emails
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ host =
|
|||||||
port =
|
port =
|
||||||
; set to "true" to activate
|
; set to "true" to activate
|
||||||
ssl = false
|
ssl = false
|
||||||
|
tls = false
|
||||||
user =
|
user =
|
||||||
password =
|
password =
|
||||||
|
|
||||||
|
|||||||
@@ -106,6 +106,8 @@ def send_email(success):
|
|||||||
server = smtplib.SMTP_SSL(**smtp)
|
server = smtplib.SMTP_SSL(**smtp)
|
||||||
else:
|
else:
|
||||||
server = smtplib.SMTP(**smtp)
|
server = smtplib.SMTP(**smtp)
|
||||||
|
if config["smtp"]["tls"]:
|
||||||
|
server.starttls()
|
||||||
if config["smtp"]["user"]:
|
if config["smtp"]["user"]:
|
||||||
server.login(config["smtp"]["user"], config["smtp"]["password"])
|
server.login(config["smtp"]["user"], config["smtp"]["password"])
|
||||||
server.sendmail(
|
server.sendmail(
|
||||||
@@ -149,6 +151,7 @@ def load_config(args):
|
|||||||
config[section][option] = 0
|
config[section][option] = 0
|
||||||
|
|
||||||
config["smtp"]["ssl"] = (config["smtp"]["ssl"].lower() == "true")
|
config["smtp"]["ssl"] = (config["smtp"]["ssl"].lower() == "true")
|
||||||
|
config["smtp"]["tls"] = (config["smtp"]["tls"].lower() == "true")
|
||||||
config["scrub"]["enabled"] = (config["scrub"]["enabled"].lower() == "true")
|
config["scrub"]["enabled"] = (config["scrub"]["enabled"].lower() == "true")
|
||||||
config["email"]["short"] = (config["email"]["short"].lower() == "true")
|
config["email"]["short"] = (config["email"]["short"].lower() == "true")
|
||||||
config["snapraid"]["touch"] = (config["snapraid"]["touch"].lower() == "true")
|
config["snapraid"]["touch"] = (config["snapraid"]["touch"].lower() == "true")
|
||||||
|
|||||||
Reference in new issue
Block a user