changeset 1169:f6dca275c5a8 beta

control mailer debug with the .ini file
author Marcin Kuzminski <marcin@python-works.com>
date Tue, 22 Mar 2011 18:10:37 +0100
parents 312712050c7e
children 6a9a5af49b97
files rhodecode/lib/celerylib/tasks.py rhodecode/lib/smtp_mailer.py
diffstat 2 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/lib/celerylib/tasks.py	Mon Mar 21 23:13:40 2011 +0100
+++ b/rhodecode/lib/celerylib/tasks.py	Tue Mar 22 18:10:37 2011 +0100
@@ -296,10 +296,11 @@
     mail_port = email_config.get('smtp_port')
     tls = str2bool(email_config.get('smtp_use_tls'))
     ssl = str2bool(email_config.get('smtp_use_ssl'))
+    debug = str2bool(config.get('debug'))
 
     try:
         m = SmtpMailer(mail_from, user, passwd, mail_server,
-                       mail_port, ssl, tls)
+                       mail_port, ssl, tls, debug=debug)
         m.send(recipients, subject, body)
     except:
         log.error('Mail sending failed')
--- a/rhodecode/lib/smtp_mailer.py	Mon Mar 21 23:13:40 2011 +0100
+++ b/rhodecode/lib/smtp_mailer.py	Tue Mar 22 18:10:37 2011 +0100
@@ -36,7 +36,7 @@
     """
 
     def __init__(self, mail_from, user, passwd, mail_server,
-                    mail_port=None, ssl=False, tls=False):
+                    mail_port=None, ssl=False, tls=False, debug=False):
 
         self.mail_from = mail_from
         self.mail_server = mail_server
@@ -45,7 +45,7 @@
         self.passwd = passwd
         self.ssl = ssl
         self.tls = tls
-        self.debug = False
+        self.debug = debug
 
     def send(self, recipients=[], subject='', body='', attachment_files=None):