I am setting up a mailer in my project and I am having difficulties sending mail through Exchange SMTP server.
I have installed the gem ruby-ntlm
but I am s
This is because you haven't included the ntlm
library.
Add the NTLM SMTP library to your config/environment.rb
file
# Load the Rails application.
require File.expand_path('../application', __FILE__)
require 'ntlm/smtp' # ADD THIS LINE HERE
# Initialize the Rails application.
Rails.application.initialize!
Found a typo, it is now working!
development.rb
Change :authentification => :ntlm
to :authentication => :ntlm
Thanks for the support anyway!
Add the ruby-ntlm gem
to your Gemfile
and run bundle install
.
Gemfile:
gem 'ruby-ntlm'
bundle install
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!
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>', # mail.example.com
:domain => '<your-domain>', # example.com
:user_name => '<your-username>', # user.name
:password => '<your-unencrypted-password>', # p@ssw0rd
:port => 25,
:authentication => :ntlm
}
Finally, make sure you change your default from whatever email address you’ve been using to reflect the new Microsoft Exchange account, or you’ll receive a 5.7.1 Client does not have permissions to send as this sender error.