Commit 257acbc4 authored by shenshuo's avatar shenshuo

tls 发送邮件增加端口

parent 4f24d1d2
......@@ -68,16 +68,16 @@ class SendMail(object):
server.login(self.__mail_user, self.__mail_password) # 登录操作
server.sendmail(self.__mail_user, to_list.split(','), msg.as_string())
server.close()
elif self.mail_tls:
# print('Use TLS SendMail')
'''使用TLS模式'''
server = smtplib.SMTP()
server.connect(self.mail_host, self.mail_port) # 连接服务器
server.starttls()
server.login(self.__mail_user, self.__mail_password) # 登录操作
server.sendmail(self.__mail_user, to_list.split(','), msg.as_string())
server.close()
return True
# elif self.mail_tls:
# # print('Use TLS SendMail')
# '''使用TLS模式'''
# server = smtplib.SMTP()
# server.connect(self.mail_host, self.mail_port) # 连接服务器
# server.starttls()
# server.login(self.__mail_user, self.__mail_password) # 登录操作
# server.sendmail(self.__mail_user, to_list.split(','), msg.as_string())
# server.close()
# return True
else:
'''使用普通模式'''
server = smtplib.SMTP()
......
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