Add debug in send_email_py

This commit is contained in:
xbgmsharp
2023-01-29 22:20:33 +01:00
parent 552faa0a16
commit 1968f86448

View File

@@ -138,6 +138,7 @@ AS $send_email_py$
server_smtp = 'localhost' server_smtp = 'localhost'
if 'app.email_server' in app and app['app.email_server']: if 'app.email_server' in app and app['app.email_server']:
server_smtp = app['app.email_server'] server_smtp = app['app.email_server']
#plpy.notice('Sending server [{}] [{}]'.format(server_smtp, app['app.email_server']))
# Send the message via our own SMTP server. # Send the message via our own SMTP server.
try: try:
@@ -154,7 +155,7 @@ AS $send_email_py$
plpy.notice('Sent email successfully to [{}] [{}]'.format(msg["To"], msg["Subject"])) plpy.notice('Sent email successfully to [{}] [{}]'.format(msg["To"], msg["Subject"]))
return None return None
except OSError as error: except OSError as error:
plpy.error(error) plpy.error('OS Error occurred: ' + str(error))
except smtplib.SMTPConnectError: except smtplib.SMTPConnectError:
plpy.error('Failed to connect to the server. Bad connection settings?') plpy.error('Failed to connect to the server. Bad connection settings?')
except smtplib.SMTPServerDisconnected: except smtplib.SMTPServerDisconnected: