comparison rhodecode/lib/rcmail/smtp_mailer.py @ 1824:89efedac4e6c beta

2012 copyrights
author Marcin Kuzminski <marcin@python-works.com>
date Wed, 04 Jan 2012 03:50:07 +0200
parents 7ff304d3028f
children 349a0ca30a75
comparison
equal deleted inserted replaced
1823:f45e83492484 1824:89efedac4e6c
4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 5
6 Simple smtp mailer used in RhodeCode 6 Simple smtp mailer used in RhodeCode
7 7
8 :created_on: Sep 13, 2010 8 :created_on: Sep 13, 2010
9 :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> 9 :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com>
10 :license: GPLv3, see COPYING for more details. 10 :license: GPLv3, see COPYING for more details.
11 """ 11 """
12 # This program is free software: you can redistribute it and/or modify 12 # This program is free software: you can redistribute it and/or modify
13 # it under the terms of the GNU General Public License as published by 13 # it under the terms of the GNU General Public License as published by
14 # the Free Software Foundation, either version 3 of the License, or 14 # the Free Software Foundation, either version 3 of the License, or
24 24
25 import logging 25 import logging
26 import smtplib 26 import smtplib
27 from socket import sslerror 27 from socket import sslerror
28 from rhodecode.lib.rcmail.message import Message 28 from rhodecode.lib.rcmail.message import Message
29
29 30
30 class SmtpMailer(object): 31 class SmtpMailer(object):
31 """SMTP mailer class 32 """SMTP mailer class
32 33
33 mailer = SmtpMailer(mail_from, user, passwd, mail_server, smtp_auth 34 mailer = SmtpMailer(mail_from, user, passwd, mail_server, smtp_auth
50 self.passwd = passwd 51 self.passwd = passwd
51 self.ssl = ssl 52 self.ssl = ssl
52 self.tls = tls 53 self.tls = tls
53 self.debug = debug 54 self.debug = debug
54 self.auth = smtp_auth 55 self.auth = smtp_auth
55
56 56
57 def send(self, recipients=[], subject='', body='', html='', 57 def send(self, recipients=[], subject='', body='', html='',
58 attachment_files=None): 58 attachment_files=None):
59 59
60 if isinstance(recipients, basestring): 60 if isinstance(recipients, basestring):