Changeset - 34846d33498d
[Not reviewed]
stable
0 2 0
Mads Kiilerich - 6 years ago 2020-02-10 15:35:05
mads@kiilerich.com
Grafted from: 7e84f7ae4711
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
2 files changed with 16 insertions and 10 deletions:
0 comments (0 inline, 0 general)
development.ini
Show inline comments
 
@@ -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*              ##
kallithea/lib/paster_commands/template.ini.mako
Show inline comments
 
@@ -55,11 +55,11 @@ error_email_from =
 
<%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 @@ 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>####################</%text>
0 comments (0 inline, 0 general)