3

I'm getting this error when trying to authenticate with Exchange Server from Ruby on Rails:

504 5.7.4 Unrecognized authentication type

config.action_mailer.raise_delivery_errors = true
config.action_mailer.perform_deliveries = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
  :address              => "x.x.x.x",
  :port                 => 25,
  :user_name            => "xxdomain\xxuser",
  :password             => "xxxxxx",
  :authentication       => :login,
  :enable_starttls_auto => true
}

I've tried all sorts of combinations of configuration settings, including changing the settings to use "plain" authentication, adding the domain, setting enable_starttls_auto to true, false, and removing it entirely, removing the port. Nothing has worked.

Any ideas?

blakeage
  • 268
  • 5
  • 15
  • Have a look at [Cannot get ActionMailer working with MS Exchange via SMTP][1]. It helped me to fix my problem. [1]: http://stackoverflow.com/questions/6523348/cannot-get-actionmailer-working-with-ms-exchange-via-smtp/12503809#12503809 – E. Sambo Sep 19 '12 at 22:50

1 Answers1

7

The below is from link:

Rails and Exchange Email Auth

1) Add the ruby-ntlm gem to your Gemfile and run bundle install.

2) Add the NTLM SMTP library to your config/environment.rb file.

# Load the rails application
  require File.expand_path('../application', __FILE__)
  require 'ntlm/smtp'
# Initialize the rails application
  RailsApp::Application.initialize! 

3) Set up your environment file to authenticate with NTLM.

config.active_support.deprecation = :notify
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
 :address => '<your-email-server>',
 :domain => '<your-domain>',
 :user_name => '<your-username>',
 :password => '<your-unencrypted-password>',
 :port => 25,
 :authentication => :ntlm

****replace values with you own***

Steve
  • 438
  • 5
  • 11
  • Welcome to Stack Overflow! While this may theoretically answer the question, [it would be preferable](http://meta.stackexchange.com/q/8259) to include the essential parts of the answer here, and provide the link for reference. – Bill the Lizard Nov 12 '11 at 13:38
  • Please fix the link. It is death – raskhadafi Oct 02 '17 at 11:05