improve SMTP SSL support
This commit is contained in:
parent
89ed643f6b
commit
1ddfb76c85
1 changed files with 4 additions and 0 deletions
|
@ -309,6 +309,10 @@ def send_email(to, subject='diffido', body='', from_=None):
|
||||||
args[key] = value
|
args[key] = value
|
||||||
try:
|
try:
|
||||||
if use_ssl:
|
if use_ssl:
|
||||||
|
for key in ('ssl_keyfile', 'ssl_certfile', 'ssl_context'):
|
||||||
|
if key in args:
|
||||||
|
args[key.replace('ssl_', '')] = args[key]
|
||||||
|
del args[key]
|
||||||
logger.debug('STMP SSL connection with args: %s' % repr(args))
|
logger.debug('STMP SSL connection with args: %s' % repr(args))
|
||||||
with smtplib.SMTP_SSL(**args) as s:
|
with smtplib.SMTP_SSL(**args) as s:
|
||||||
if username:
|
if username:
|
||||||
|
|
Loading…
Reference in a new issue