def send1(self,warning):
m1=self.mailEdit.text()
m2=self.mailEdit_2.text()
m3=self.mailBox.currentText()
text=self.mailEdit_3.text()
import smtplib#man1邮箱服务器man2邮箱地址,paww是密码,text文本
from email.mime.text import MIMEText
msg=MIMEText(warning)
msg[‘Subject‘] = u‘pyqt的问题‘
msg[‘Form‘]=‘[email protected]‘
try:
smtp=smtplib.SMTP()
smtp.connect(unicode(m1))
smtp.login(‘%s‘%(m2),text)
smtp.sendmail(‘%s‘%(m2),[‘%s‘%(m2)], msg.as_string())
smtp.close()
except Exception as e:
print e
时间: 2025-01-01 21:00:07