changeset 1583:8e77c75bd65a beta

made auth type optional in constructor
author Marcin Kuzminski <marcin@python-works.com>
date Fri, 21 Oct 2011 13:28:32 +0200
parents e060b2be1ea5
children 8628c8706bf8
files rhodecode/lib/smtp_mailer.py
diffstat 1 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/lib/smtp_mailer.py	Fri Oct 21 13:26:54 2011 +0200
+++ b/rhodecode/lib/smtp_mailer.py	Fri Oct 21 13:28:32 2011 +0200
@@ -36,11 +36,10 @@
 from email import encoders
 
 
-
 class SmtpMailer(object):
     """SMTP mailer class
 
-    mailer = SmtpMailer(mail_from, user, passwd, mail_server,
+    mailer = SmtpMailer(mail_from, user, passwd, mail_server, smtp_auth
                         mail_port, ssl, tls)
     mailer.send(recipients, subject, body, attachment_files)
 
@@ -50,8 +49,8 @@
 
     """
 
-    def __init__(self, mail_from, user, passwd, mail_server,smtp_auth,
-                    mail_port=None, ssl=False, tls=False, debug=False):
+    def __init__(self, mail_from, user, passwd, mail_server, smtp_auth=None,
+                 mail_port=None, ssl=False, tls=False, debug=False):
 
         self.mail_from = mail_from
         self.mail_server = mail_server
@@ -83,8 +82,8 @@
         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
+        # if server requires authorization you must provide login and password
+        # but only if we have them
         if self.user and self.passwd:
             smtp_serv.login(self.user, self.passwd)
 
@@ -160,6 +159,7 @@
         if isinstance(msg_file, str):
             return open(msg_file, "rb").read()
         else:
-            #just for safe seek to 0
+            # just for safe seek to 0
             msg_file.seek(0)
             return msg_file.read()
+