python发邮件遇到的问题
#!D:\Python33\python3#coding:utf-8importsmtplibfromemail.mime.textimportMIMETextfrome...
#!D:\Python33\python3#coding:utf-8import smtplibfrom email.mime.text import MIMETextfrom email.header import Header
sender = "发件人邮箱"receiver = "收件人邮箱" subject = "测试邮件"smtpserver = "smtp.exmail.qq.com"username = '我的账号'password = '我的密码'
msg = MIMEText('你好','text','utf-8')msg['Subject'] = Header(subject,'utf-8')
smtp = smtplib.SMTP()smtp.connect('smtp.exmail.qq.com')smtp.login(username,password)smtp.sendmail(sender,receiver,msg.as_string())smtp.quit()
结果如图,邮件已经发出,但是发件人位置为代发;邮件内容为空,请大神帮我改改怎么才能让发件人不是代发,内容不为空。 展开
sender = "发件人邮箱"receiver = "收件人邮箱" subject = "测试邮件"smtpserver = "smtp.exmail.qq.com"username = '我的账号'password = '我的密码'
msg = MIMEText('你好','text','utf-8')msg['Subject'] = Header(subject,'utf-8')
smtp = smtplib.SMTP()smtp.connect('smtp.exmail.qq.com')smtp.login(username,password)smtp.sendmail(sender,receiver,msg.as_string())smtp.quit()
结果如图,邮件已经发出,但是发件人位置为代发;邮件内容为空,请大神帮我改改怎么才能让发件人不是代发,内容不为空。 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询