相关疑难解决方法(0)

无法使ActionMailer通过SMTP与MS Exchange一起使用

这是我的简单测试程序(使用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': …
Run Code Online (Sandbox Code Playgroud)

ruby email exchange-server smtp ruby-on-rails-3

8
推荐指数
2
解决办法
1万
查看次数

标签 统计

email ×1

exchange-server ×1

ruby ×1

ruby-on-rails-3 ×1

smtp ×1