处理登录认证

This commit is contained in:
halliday 2024-03-19 17:29:51 +08:00
parent 6d31ba18c8
commit b1a22f817c
1 changed files with 4 additions and 3 deletions

View File

@ -22,9 +22,9 @@ week = str(datetime.now().isocalendar()[1])
def send_mail(): def send_mail():
# 发件人 # 发件人
sender = 'mh@unamail.com' sender = 'mh@una-mail.com'
# 接收邮件,可以发给多人 # 接收邮件,可以发给多人
receivers = ['mh@unamail.com','zry@unamail.com','ypy@unamail.com','zxw@unamail.com'] receivers = ['mh@una-mail.com','yk@una-mail.com','sr@una-mail.com','dn@una-mail.com']
# 邮件主体 # 邮件主体
msg = MIMEMultipart() msg = MIMEMultipart()
# 正文取文本中的内容 # 正文取文本中的内容
@ -46,9 +46,10 @@ def send_mail():
#att["Content-Disposition"] = 'attachment; filename="{}"'.format( #att["Content-Disposition"] = 'attachment; filename="{}"'.format(
# file_name_week) # file_name_week)
#msg.attach(att) #msg.attach(att)
try: try:
smtpObj = smtplib.SMTP('10.10.110.102') smtpObj = smtplib.SMTP('10.10.110.102')
#身份认证
smtpObj.login(sender,"111111")
smtpObj.sendmail(sender, receivers, msg.as_string()) smtpObj.sendmail(sender, receivers, msg.as_string())
print("邮件发送成功") print("邮件发送成功")
except smtplib.SMTPException: except smtplib.SMTPException: