Commits

Anonymous committed 67377fd

applied smth_auth options update patch

  • Participants
  • Parent commits f0437ae
  • Branches beta

Comments (0)

Files changed (3)

File rhodecode/config/deployment.ini_tmpl

 #smtp_port = 
 #smtp_use_tls = false
 #smtp_use_ssl = true
+# Specify available auth parameters here (e.g. LOGIN PLAIN CRAM-MD5, etc.)
+#smtp_auth = 
 
 [server:main]
 ##nr of threads to spawn

File rhodecode/lib/celerylib/tasks.py

     tls = str2bool(email_config.get('smtp_use_tls'))
     ssl = str2bool(email_config.get('smtp_use_ssl'))
     debug = str2bool(config.get('debug'))
+    smtp_auth = email_config.get('smtp_auth')
 
     try:
-        m = SmtpMailer(mail_from, user, passwd, mail_server,
+        m = SmtpMailer(mail_from, user, passwd, mail_server,smtp_auth,
                        mail_port, ssl, tls, debug=debug)
         m.send(recipients, subject, body)
     except:

File rhodecode/lib/smtp_mailer.py

 from email import encoders
 
 
+
 class SmtpMailer(object):
     """SMTP mailer class
 
 
     """
 
-    def __init__(self, mail_from, user, passwd, mail_server,
+    def __init__(self, mail_from, user, passwd, mail_server,smtp_auth,
                     mail_port=None, ssl=False, tls=False, debug=False):
 
         self.mail_from = mail_from
         self.ssl = ssl
         self.tls = tls
         self.debug = debug
+        self.auth = smtp_auth
 
     def send(self, recipients=[], subject='', body='', attachment_files=None):
 
             smtp_serv.set_debuglevel(1)
 
         smtp_serv.ehlo()
+        if self.auth:
+            smtp_serv.esmtp_features["auth"] = self.auth
 
         #if server requires authorization you must provide login and password
         #but only if we have them