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

using smtplib server accepting email with space

我正在使用 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))检查是不是读错了文件,但也不是这样的!

我哪里做错了?

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

我找到了解决方法。

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

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'