INNER CODE UNIT · Python
aqzt/kjyw · mail/mail.test.py:11
def mail():
message=MIMEText('python 邮件发送111','plain','utf-8')
message['From']='{}'.format(sender)
message['To']=','.join(recivers)
message['Subject']='邮件测试222'
try:
smtpobj=smtplib.SMTP_SSL(host,465)#启用ssl,端口为465
smtpobj.login(sender,sender_pass)
smtpobj.sendmail(sender,recivers,message.as_string())
print('sucess')
smtpobj.quit()
except:
print('error')
mail()