mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-04-15 22:51:37 -07:00
PUSHPROD 23.01.03 HF02
This commit is contained in:
@@ -2594,6 +2594,7 @@ def send_email (pText, pHTML):
|
|||||||
smtp_connection = smtplib.SMTP (SMTP_SERVER, SMTP_PORT)
|
smtp_connection = smtplib.SMTP (SMTP_SERVER, SMTP_PORT)
|
||||||
smtp_connection.ehlo()
|
smtp_connection.ehlo()
|
||||||
|
|
||||||
|
try:
|
||||||
if not SafeParseGlobalBool("SMTP_SKIP_TLS"):
|
if not SafeParseGlobalBool("SMTP_SKIP_TLS"):
|
||||||
smtp_connection.starttls()
|
smtp_connection.starttls()
|
||||||
smtp_connection.ehlo()
|
smtp_connection.ehlo()
|
||||||
@@ -2602,6 +2603,9 @@ def send_email (pText, pHTML):
|
|||||||
|
|
||||||
smtp_connection.sendmail (REPORT_FROM, REPORT_TO, msg.as_string())
|
smtp_connection.sendmail (REPORT_FROM, REPORT_TO, msg.as_string())
|
||||||
smtp_connection.quit()
|
smtp_connection.quit()
|
||||||
|
except smtplib.SMTPAuthenticationError as e:
|
||||||
|
file_print(' ERROR: Couldn\'t connect to the SMTP, skipping Email')
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
def SafeParseGlobalBool(boolVariable):
|
def SafeParseGlobalBool(boolVariable):
|
||||||
@@ -3208,8 +3212,12 @@ def get_all_devices():
|
|||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
def hide_email(email):
|
def hide_email(email):
|
||||||
m = email.split('@')
|
m = email.split('@')
|
||||||
|
|
||||||
|
if len(m) == 2:
|
||||||
return f'{m[0][0]}{"*"*(len(m[0])-2)}{m[0][-1] if len(m[0]) > 1 else ""}@{m[1]}'
|
return f'{m[0][0]}{"*"*(len(m[0])-2)}{m[0][-1] if len(m[0]) > 1 else ""}@{m[1]}'
|
||||||
|
|
||||||
|
return email
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
# Cron-like Scheduling
|
# Cron-like Scheduling
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user