import smtplib
import os
EMAIL_ADDRESS = abc@gmail.com
EMAIL_PASSWORD = os.environ.get('EMAIL_PASS')
with smtplib.SMTP('smtp.gmail.com',587) as smtp:
smtp.ehlo() #identifies ourselves with the mail server that we are using
smtp.starttls() #to encrypt the traffic
smtp.ehlo() #to re-identify ourselves as encrypted connection
smtp.login(EMAIL_ADDRESS, EMAIL_PASSWORD)
subject = "Regarding your text role"
body = "This is to inform u that ur text role has been updated"
msg = f'Subject: {subject}\n\n{body}'
smtp.sendmail('Random User <abc@gmail.com>','abcd@gmail.com', msg)
即使代码得到了成功执行,我也没有在中获得显示名为“Random User”abcd@gmail.com
有什么问题吗
目前没有回答
相关问题 更多 >
编程相关推荐