Add email backend
This commit is contained in:
parent
ef4ae7942f
commit
432f2854d5
|
@ -0,0 +1,19 @@
|
|||
import smtplib
|
||||
from email.mime.text import MIMEText
|
||||
|
||||
|
||||
def send(config, message):
|
||||
if config["ssl"]:
|
||||
smtp = smtplib.SMTP_SSL(config["url"], config["port"])
|
||||
smtp.starttls()
|
||||
else:
|
||||
smtp = smtplib.SMTP(config["url"], config["port"])
|
||||
if config["tls"]:
|
||||
smtp.starttls()
|
||||
|
||||
msg = MIMEText(message)
|
||||
msg["Subject"] = "Access to The Long Night"
|
||||
msg["From"] = config["from"]
|
||||
msg["To"] = config["tos"]
|
||||
smtp.login(config["login"], config["password"])
|
||||
smtp.send_message(msg, from_addr=config["from"], to_addrs=config["tos"])
|
Loading…
Reference in New Issue