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
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 => '', # mail.example.com
:domain => '', # example.com
:user_name => '', # user.name
: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.