Ruby 1.9.2中的AUTH不可用(Net :: SMTPAuthenticationError)

Dhe*_*thi 5 ruby smtp

我试图从MS Exchange服务器发送邮件,但我收到错误

`check_auth_response':503#5.3.3 AUTH不可用(Net :: SMTPAuthenticationError)

我用来发送邮件的代码是

require 'net/smtp'
require 'mail'

smtp = Net::SMTP.new('mycompanydomain',25)
smtp.start('mycompanydomain', 'name@company.com', 'pwd',:plain) do |smtp|
  # code to send mail
end
Run Code Online (Sandbox Code Playgroud)

注意:它适用于Gmail帐户,但无法使用公司帐户.任何帮助都会有用.

Mic*_*ile 1

你确定你的服务器支持AUTH吗?您可以通过以下方式了解:

如果连接未加密:

telnet mycompanydomain 25
ehlo testing
Run Code Online (Sandbox Code Playgroud)

它应该回应说AUTH PLAIN它应该用其中如果没有,您的服务器不支持普通身份验证,它可能会列出其他身份验证方法。您可能需要将其设置为其中之一。

更多信息http://qmail.jms1.net/test-auth.shtml