相关疑难解决方法(0)

如何在不登录服务器的情况下在 Python 中发送电子邮件

我想在没有登录 Python 服务器的情况下发送电子邮件。我正在使用 Python 3.6。我尝试了一些代码,但收到一个错误。这是我的代码:

import smtplib                          

smtpServer='smtp.yourdomain.com'      
fromAddr='from@Address.com'         
toAddr='to@Address.com'     
text= "This is a test of sending email from within Python."
server = smtplib.SMTP(smtpServer)
server.set_debuglevel(1)         
server.sendmail(fromAddr, toAddr, text) 
server.quit()
Run Code Online (Sandbox Code Playgroud)

我希望应该在不询问用户 ID 和密码的情况下发送邮件但收到错误:

"smtplib.SMTPSenderRefused: (530, b'5.7.1 客户端未通过身份验证', 'from@Address.com')"

smtplib python-3.x

6
推荐指数
3
解决办法
2万
查看次数

标签 统计

python-3.x ×1

smtplib ×1