Commit f68d15f5 authored by shenshuo's avatar shenshuo

tls 发送邮件增加端口

parent 8e7f2eda
...@@ -21,7 +21,8 @@ class BaseHandler(RequestHandler): ...@@ -21,7 +21,8 @@ class BaseHandler(RequestHandler):
# 验证客户端CSRF,如请求为GET,则不验证,否则验证。最后将写入新的key # 验证客户端CSRF,如请求为GET,则不验证,否则验证。最后将写入新的key
cache = get_cache() cache = get_cache()
if self.request.method != 'GET': if self.request.method not in ("GET", "HEAD", "OPTIONS"):
# if self.request.method not in ("GET", "HEAD", "OPTIONS") and self.application.settings.get("xsrf_cookies"):
csrf_key = self.get_cookie('csrf_key') csrf_key = self.get_cookie('csrf_key')
pipeline = cache.get_pipeline() pipeline = cache.get_pipeline()
result = cache.get(csrf_key, private=False, pipeline=pipeline) result = cache.get(csrf_key, private=False, pipeline=pipeline)
......
...@@ -71,7 +71,7 @@ class SendMail(object): ...@@ -71,7 +71,7 @@ class SendMail(object):
# print('Use TLS SendMail') # print('Use TLS SendMail')
'''使用普通模式''' '''使用普通模式'''
server = smtplib.SMTP() server = smtplib.SMTP()
server.connect(self.mail_host) # 连接服务器 server.connect(self.mail_host, self.mail_port) # 连接服务器
server.login(self.__mail_user, self.__mail_password) # 登录操作 server.login(self.__mail_user, self.__mail_password) # 登录操作
server.sendmail(self.__mail_user, to_list.split(','), msg.as_string()) server.sendmail(self.__mail_user, to_list.split(','), msg.as_string())
server.close() server.close()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment