Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
338 views
in Technique[技术] by (71.8m points)

ruby - Cannot get ActionMailer working with MS Exchange via SMTP

Here's my simple test program (using 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

Trying various authentication types I get the following errors:

:plain error:

smtp.rb:966:in `check_auth_response': 504 5.7.4 Unrecognized authentication type. (Net::SMTPAuthenticationError)

:login error:

smtp.rb:972:in `check_auth_continue': 504 5.7.4 Unrecognized authentication type. (Net::SMTPSyntaxError)

:cram_md5 error:

smtp.rb:972:in `check_auth_continue': 504 5.7.4 Unrecognized authentication type. (Net::SMTPSyntaxError)

No authentication error:

protocol.rb:135:in `read_nonblock': end of file reached (EOFError)

Any ideas?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Check what authentication schemes are enabled

It could be: none, plain, login, cram_md5, NTLM, StartTLS

  • Using Telnet to connect to Exchange 2003 POP3 mailboxes and using SMTP to send e-mail for troubleshooting purposes

How to properly access Exchange

Good resources that should help you to understand and troubleshoot it.

How you could change Exchange to fix the problem

(instead of changing how you access Exchange)

Redmine specific

Helpful for Ruby on Rails


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...