changeset 8233:34846d33498d stable

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 <backlash.tracing.reporters.mail.EmailReporter object at 0x7f8f986f8710> 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
author Mads Kiilerich <mads@kiilerich.com>
date Mon, 10 Feb 2020 15:35:05 +0100
parents 2571674c4a2f
children 8169770a4f2c
files development.ini kallithea/lib/paster_commands/template.ini.mako
diffstat 2 files changed, 16 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/development.ini	Mon Feb 03 20:50:07 2020 +0100
+++ b/development.ini	Mon Feb 10 15:35:05 2020 +0100
@@ -54,11 +54,11 @@
 ## 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 @@
 
 # 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*              ##
--- a/kallithea/lib/paster_commands/template.ini.mako	Mon Feb 03 20:50:07 2020 +0100
+++ b/kallithea/lib/paster_commands/template.ini.mako	Mon Feb 10 15:35:05 2020 +0100
@@ -55,11 +55,11 @@
 <%text>## For "SSL", use smtp_use_ssl = true and smtp_port = 465.</%text>
 <%text>## For "STARTTLS", use smtp_use_tls = true and smtp_port = 587.</%text>
 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'</%text>
@@ -435,10 +435,13 @@
 
 # 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>####################</%text>