def mail():
n=123
n+=1
print(n)
return 1
mail()------------执行
#
import smtplib
from email.mime.text import MIMEText
from emial.utils import formataddr
def mail(user)
ret=ture
try:
msg=MIMEText('邮件内容',‘plain’,‘utf-8’)
msg['from']=formataddr(["张扬",‘wptawwy@126.com’])
msg['to']=formataddr(["张兮兮",‘1696824781@qq.com’])
msg['Subject']="主题"
server=stmplib.SMTP("smtp.126.com",25)
server.login("wptawwy@126.com","ww.3945.59")
server.sendmail('wptawwy@126.com',[user,],msg.as_string())
server.quit()
except Exception:
ret=flase
return ret
ret=mail('1696824781@qq.com’)