##// END OF EJS Templates
control mailer debug with the .ini file
marcink -
r1169:f6dca275 beta
parent child Browse files
Show More
@@ -296,10 +296,11 b' def send_email(recipients, subject, body'
296 mail_port = email_config.get('smtp_port')
296 mail_port = email_config.get('smtp_port')
297 tls = str2bool(email_config.get('smtp_use_tls'))
297 tls = str2bool(email_config.get('smtp_use_tls'))
298 ssl = str2bool(email_config.get('smtp_use_ssl'))
298 ssl = str2bool(email_config.get('smtp_use_ssl'))
299 debug = str2bool(config.get('debug'))
299
300
300 try:
301 try:
301 m = SmtpMailer(mail_from, user, passwd, mail_server,
302 m = SmtpMailer(mail_from, user, passwd, mail_server,
302 mail_port, ssl, tls)
303 mail_port, ssl, tls, debug=debug)
303 m.send(recipients, subject, body)
304 m.send(recipients, subject, body)
304 except:
305 except:
305 log.error('Mail sending failed')
306 log.error('Mail sending failed')
@@ -36,7 +36,7 b' class SmtpMailer(object):'
36 """
36 """
37
37
38 def __init__(self, mail_from, user, passwd, mail_server,
38 def __init__(self, mail_from, user, passwd, mail_server,
39 mail_port=None, ssl=False, tls=False):
39 mail_port=None, ssl=False, tls=False, debug=False):
40
40
41 self.mail_from = mail_from
41 self.mail_from = mail_from
42 self.mail_server = mail_server
42 self.mail_server = mail_server
@@ -45,7 +45,7 b' class SmtpMailer(object):'
45 self.passwd = passwd
45 self.passwd = passwd
46 self.ssl = ssl
46 self.ssl = ssl
47 self.tls = tls
47 self.tls = tls
48 self.debug = False
48 self.debug = debug
49
49
50 def send(self, recipients=[], subject='', body='', attachment_files=None):
50 def send(self, recipients=[], subject='', body='', attachment_files=None):
51
51
General Comments 0
You need to be logged in to leave comments. Login now