SMTP_SKIP_TLS fix

This commit is contained in:
Jokob-sk
2023-01-10 21:12:37 +11:00
parent 593c03b035
commit 121b5cdf32

View File

@@ -2394,24 +2394,18 @@ def send_email (pText, pHTML):
smtp_connection.ehlo()
try:
if not SafeParseGlobalBool("SMTP_SKIP_TLS"):
if not SMTP_SKIP_TLS:
smtp_connection.starttls()
smtp_connection.ehlo()
if not SafeParseGlobalBool("SMTP_SKIP_LOGIN"):
if not SMTP_SKIP_LOGIN:
smtp_connection.login (SMTP_USER, SMTP_PASS)
smtp_connection.sendmail (REPORT_FROM, REPORT_TO, msg.as_string())
smtp_connection.quit()
except smtplib.SMTPAuthenticationError as e:
file_print(' ERROR: Couldn\'t connect to the SMTP, skipping Email')
file_print(' ERROR: Couldn\'t connect to the SMTP server, skipping Email')
#-------------------------------------------------------------------------------
def SafeParseGlobalBool(boolVariable):
if boolVariable in globals():
return eval(boolVariable)
return False
#-------------------------------------------------------------------------------
def send_webhook (_json, _html):