使用smtplib服务器接受sp的电子邮件

2024-07-04 17:30:42 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用server.mail()函数检查邮件中继是否可用。我收到服务器的响应,这是出乎意料的。

send: 'mail FROM:<bhanukrsingh@outlook.com> b h a n u k r s i n g h @ o u t l o o k . c o m\r\n'
reply: b'501 5.5.4 Invalid arguments [CO1NAM05FT018.eop-nam05.prod.protection.outlook.com]\r\n'

为什么我会收到这样的电子邮件ID?它应该是这样的send: 'mail FROM:<bhanukrsingh@outlook.com> bhanukrsingh@outlook.com\r\n'

我用print(repr(email))来检查我是否读错了文件,但事实并非如此

我哪里做错了

这是我的完整代码的链接:https://github.com/Rwarlock/mxrecordchecker/blob/master/mxrecord.py


Tags: 函数from服务器comsendserver邮件mail
1条回答
网友
1楼 · 发布于 2024-07-04 17:30:42

我找到了解决办法

基本上我使用的是使用这部分代码来发送邮件

server.mail('bhanukrsingh@outlook.com',email)

但现在我用的是:

server.mail('example@outlook.com')
server.rcpt(email)

这将根据需要为我提供服务器响应:

send: 'mail FROM:<example@outlook.com>\r\n'
send: 'rcpt TO:<example@outlook.com>\r\n'

相关问题 更多 >

    热门问题