I have the below configuration on my development.rb and production.rb.
config.action_mailer.default_url_options = { host: ENV["HOST_NAME"] }
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default_options = { from: ENV["EMAIL_USERNAME"] }
config.action_mailer.perform_caching = false
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: 'smtp.office365.com',
port: 587,
domain: 'smtp.office365.com',
user_name: ENV["EMAIL_USERNAME"],
password: ENV["EMAIL_PASSWORD"],
authentication: :login,
enable_starttls_auto: true
}
When I try to send from the local the mail sent without any problem. but in production I get the error message.
I used the authentication: :login
method to authenticate, but the error throws
Net::SMTPAuthenticationError (535 5.7.3 Authentication unsuccessful [MW4P221CA0003.NAMP221.PROD.OUTLOOK.COM])
I also changed the Email settings to allow (POP and IMAP) on the settings/mail/sync mail/
Thanks In Advance :)