host is a local var
This commit is contained in:
parent
79c3394e2c
commit
c893a06f37
@ -20,18 +20,17 @@ class SMTPConnection(MailConnection):
|
|||||||
self.username = username
|
self.username = username
|
||||||
self.password = password
|
self.password = password
|
||||||
self.use_tls = use_tls
|
self.use_tls = use_tls
|
||||||
self.host = None
|
|
||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
def _host(self):
|
def _host(self):
|
||||||
host = None
|
host = None
|
||||||
|
|
||||||
if self.use_tls:
|
if self.use_tls:
|
||||||
self.host = smtplib.SMTP(self.server, self.port)
|
host = smtplib.SMTP(self.server, self.port)
|
||||||
self.host.starttls()
|
host.starttls()
|
||||||
else:
|
else:
|
||||||
self.host = smtplib.SMTP_SSL(self.server, self.port)
|
host = smtplib.SMTP_SSL(self.server, self.port)
|
||||||
self.host.login(self.username, self.password)
|
host.login(self.username, self.password)
|
||||||
|
|
||||||
yield host
|
yield host
|
||||||
|
|
||||||
@ -85,8 +84,3 @@ class Mailer(object):
|
|||||||
@property
|
@property
|
||||||
def messages(self):
|
def messages(self):
|
||||||
return self.connection.messages
|
return self.connection.messages
|
||||||
|
|
||||||
|
|
||||||
class RedisMailer(object):
|
|
||||||
def __init__(self, *args, **kwargs):
|
|
||||||
pass
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user