c# SMTP auth send问题参数或参数中的语法错误
我在 C# 中有一个发送电子邮件的方法。工作正常,已经工作两年了。
我在使用一台 SMTP 服务器时遇到了问题。我使用 SmartSniff 查看 TCP 对话,发现握手有问题:
命令后
授权登录 dGJp
我收到一条错误消息
501 参数或参数中的语法错误
另一方面,当我使用同一帐户从 Outlook 发送邮件时,上述命令分为两部分:
授权登录
334 VXNlcm5hbWU6
dGJp
如您所见,从 Outlook 发送时,客户端在发送用户名和服务器响应询问“用户名:”之前暂停 (VXNlcm5hbWU6) 该行之后没有发生错误。然后服务器要求输入密码并回复 235 Authentication success
有人遇到过这个问题吗?
我尝试使用不同的邮件服务器,并且在一行上进行身份验证时一切正常(第一个示例)。由于某种原因,该 SMTP 服务器不喜欢它。
有什么想法吗?
I have a method in c# that sends email. Works fine and has been working fine for two years.
I ran into a problem with one SMTP server. I viewed TCP conversation using SmartSniff and found a problematic handshake:
after command
AUTH login dGJp
I get an error saying
501 Syntax error in parameters or arguments
On the other hand, when I send mail from outlook with the same account the above command is split in two parts:
AUTH LOGIN
334 VXNlcm5hbWU6
dGJp
As you can see, when sending from outlook, client pauses before sending username and server responses asking "Username:" (VXNlcm5hbWU6)
No error happend after that line. Then the server asks for password and replys with 235 Authentication successful
Has anyone ran into this problem?
I tried with different mail servers and everything works OK when authenticating on one line (first example). For some reason this SMTP server does not like it.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它并没有真正帮助您,但 AUTH LOGIN 已被弃用,非标准方法,它没有正式的规范。有一个信息性 RFC 试图记录它以用于历史目的和 Microsoft 规范。这些是互相矛盾的。 .Net 似乎以 Microsoft 的方式实现它,而您遇到的服务器则以其他方式实现它。 (顺便问一下,它使用哪个服务器软件?)如果可能,请使用标准的 AUTH PLAIN 方法。
It does not really help you, but AUTH LOGIN is deprecated, non-standard method, it does not have a formal specification. There is an informational RFC attempting to document it for historical purposes and a Microsoft specification. These contradict each other. .Net seems to be implementing it in the Microsoft way, while the server you encountered implements it otherwise. (Which server software does it use by the way?) If possible use the AUTH PLAIN method which is standard.