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?
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.
- The EHLO verb and SMTP extensions
- The AUTH Command
- How to Use Telnet to Send SMTP Email to Exchange 2007 and 2010
- Using telnet to test authenticated relay in Exchange
How you could change Exchange to fix the problem
(instead of changing how you access Exchange)
- How to enable auth login on smtp server exchange 2010
- How to Enable "Auth Login" authenticaton on Exchange
- Error in establishing SMTP connection, Error: 504 5.7.4 Unrecognized authentication type
- (how to change the Exchange 2010 configuration to "accept mail from third part product" as mentioned by Anil K Singh)
Redmine specific
Helpful for Ruby on Rails
- How to configure Redmine to mail to MS Exchange server
- Helpful troubleshooting tips for Ruby on Rails code
- How to use ruby-ntlm in case Exchange requires NTLM
- How to use the TLS option
had similar network issues. use the code below in irb
to get debug info right in the console.
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)
never really found out what the issue was. they moved the exchange server and the production server stopped sending emails. im not really an IT guy but there were different debug logs depending which part of the network i was on. finally "solved" the problem by sending unauthenticated email...
You could connect to the SMTP server and query the supported authentication methods:
telnet smtp.server.net 25 EHLO
The server should respond with at least one line that starts with 250-AUTH
. After that the supported authentication methods are listed. Chances are that the Exchange server only supports authentication via GSSAPI or NTLM. In the latter case you might be able to get it to work with the ruby-ntlm gem and the ntlm
authentication method. (See http://www.breckenedge.com/configuration-of-ruby-on-rails-actionmailer-for-microsoft-exchange-smtp)