Anonymous avatar Anonymous committed 67377fd

applied smth_auth options update patch

Comments (0)

Files changed (3)

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

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:

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
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.