# HG changeset patch # User Mads Kiilerich # Date 2020-02-10 15:35:05 # Node ID 34846d33498da856fc6d0a175a858bb452d49a14 # Parent 2571674c4a2fd6247a6dee7d9b4e27df13df1429 mails: make error reporting by mail work with secure mail servers Even with Kallithea mails working, TurboGears / backlash error reporting would fail like: Error while reporting exception with Traceback (most recent call last): File ".../env/lib/python3.7/site-packages/backlash/tracing/reporters/mail.py", line 49, in report result = server.sendmail(self.from_address, self.error_email, msg.as_string()) File "/usr/lib64/python3.7/smtplib.py", line 867, in sendmail raise SMTPSenderRefused(code, resp, from_addr) smtplib.SMTPSenderRefused: (530, b'5.7.0 Must issue a STARTTLS command first.', 'kallithea@example.com') Extend the .ini template to forward all the mail settings described on https://turbogears.readthedocs.io/en/latest/reference/config-options.html#error-reporting diff --git a/development.ini b/development.ini --- a/development.ini +++ b/development.ini @@ -54,11 +54,11 @@ error_email_from = ## For "SSL", use smtp_use_ssl = true and smtp_port = 465. ## For "STARTTLS", use smtp_use_tls = true and smtp_port = 587. smtp_server = -#smtp_username = -#smtp_password = +smtp_username = +smtp_password = smtp_port = -#smtp_use_ssl = false -#smtp_use_tls = false +smtp_use_ssl = false +smtp_use_tls = false ## Entry point for 'gearbox serve' [server:main] @@ -330,10 +330,13 @@ session.secret = development-not-secret # Propagate email settings to ErrorReporter of TurboGears2 # You do not normally need to change these lines -get trace_errors.error_email = email_to get trace_errors.smtp_server = smtp_server get trace_errors.smtp_port = smtp_port get trace_errors.from_address = error_email_from +get trace_errors.error_email = email_to +get trace_errors.smtp_username = smtp_username +get trace_errors.smtp_password = smtp_password +get trace_errors.smtp_use_tls = smtp_use_tls ################################################################################ ## WARNING: *DEBUG MODE MUST BE OFF IN A PRODUCTION ENVIRONMENT* ## diff --git a/kallithea/lib/paster_commands/template.ini.mako b/kallithea/lib/paster_commands/template.ini.mako --- a/kallithea/lib/paster_commands/template.ini.mako +++ b/kallithea/lib/paster_commands/template.ini.mako @@ -55,11 +55,11 @@ error_email_from = <%text>## For "SSL", use smtp_use_ssl = true and smtp_port = 465. <%text>## For "STARTTLS", use smtp_use_tls = true and smtp_port = 587. smtp_server = -#smtp_username = -#smtp_password = +smtp_username = +smtp_password = smtp_port = -#smtp_use_ssl = false -#smtp_use_tls = false +smtp_use_ssl = false +smtp_use_tls = false %if http_server != 'uwsgi': <%text>## Entry point for 'gearbox serve' @@ -435,10 +435,13 @@ session.secret = ${uuid()} # Propagate email settings to ErrorReporter of TurboGears2 # You do not normally need to change these lines -get trace_errors.error_email = email_to get trace_errors.smtp_server = smtp_server get trace_errors.smtp_port = smtp_port get trace_errors.from_address = error_email_from +get trace_errors.error_email = email_to +get trace_errors.smtp_username = smtp_username +get trace_errors.smtp_password = smtp_password +get trace_errors.smtp_use_tls = smtp_use_tls %if error_aggregation_service == 'appenlight': <%text>####################