Edw*_*ler 8 ruby email exchange-server smtp ruby-on-rails-3
这是我的简单测试程序(使用ActionMailer 3.0.8,Ruby 1.9.2p180 Mac OS X):
require 'rubygems'
require 'action_mailer'
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => "my_exchange_server",
:port => 25,
:domain => 'my_domain.org',
:authentication => :login,
:user_name => 'my_user',
:password => 'my_password',
:enable_starttls_auto => false
}
ActionMailer::Base.raise_delivery_errors = true
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.default :from => 'from_email@my_company.com'
m = ActionMailer::Base.mail :to => 'to_email@my_company.com', :subject => 'this is a test', :body => 'this is a test'
m.deliver
Run Code Online (Sandbox Code Playgroud)
尝试各种身份验证类型我收到以下错误:
:普通错误:
smtp.rb:966:in `check_auth_response': 504 5.7.4 Unrecognized authentication type. (Net::SMTPAuthenticationError)
Run Code Online (Sandbox Code Playgroud)
:登录错误:
smtp.rb:972:in `check_auth_continue': 504 5.7.4 Unrecognized authentication type. (Net::SMTPSyntaxError)
Run Code Online (Sandbox Code Playgroud)
:cram_md5错误:
smtp.rb:972:in `check_auth_continue': 504 5.7.4 Unrecognized authentication type. (Net::SMTPSyntaxError)
Run Code Online (Sandbox Code Playgroud)
没有验证错误:
protocol.rb:135:in `read_nonblock': end of file reached (EOFError)
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
E. *_*mbo 13
它可能是:none,plain,login,cram_md5,NTLM,StartTLS
250-AUTH LOGIN"或" 250-AUTH=LOGIN"表示您需要进行身份验证.250-AUTH"(在该行上没有其他任何内容!)似乎表明你不应该自己验证!否则你会收到错误:
良好的资源,可以帮助您理解和排除故障.
(而不是更改您访问Exchange的方式)
Ruby on Rails很有用
有类似的网络问题.使用下面的代码irb在控制台中获取调试信息.
require 'net/smtp'
smtp = Net::SMTP.new('ip_or_dns_address', port)
smtp.debug_output = $stdout
smtp.enable_starttls_auto#skip if not needed
smtp.start("domain", "user", "password", auth_type)
Run Code Online (Sandbox Code Playgroud)
从来没有真正发现问题是什么.他们移动了Exchange服务器,生产服务器停止发送电子邮件.我不是一个真正的IT人员,但根据我所在网络的哪个部分,有不同的调试日志.最后通过发送未经身份验证的电子邮件"解决"了问题...
| 归档时间: |
|
| 查看次数: |
12939 次 |
| 最近记录: |