I have this code on my production.rb and development.rb.
config.active_record.dump_schema_after_migration = false
config.action_mailer.perform_deliveries = true
config.action_mailer.default_url_options = { host: 'mydomain.com' }
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: 'smtp.office365.com',
port: '587',
authentication: 'login',
domain: 'mydomain.com',
user_name: "[email protected]",
password: "password",
enable_starttls_auto: true,
openssl_verify_mode: 'none'
}
I am trying to send mail from my office 365 mail account using action mailer. This sends the mail perfectly fine on localhost. But it raises the following error during production. I am using digitalocean server.
App 7718 stdout: [7bd99d32-f3c4-49c3-abfd-ff19fa7ddb8a] Completed 500 Internal Server Error in 8800ms (ActiveRecord: 1.6ms) App 7718 stdout: [7bd99d32-f3c4-49c3-abfd-ff19fa7ddb8a]
App 7718 stdout: [7bd99d32-f3c4-49c3-abfd-ff19fa7ddb8a] Net::SMTPAuthenticationError (535 5.7.3 Authentication unsuccessful [CO2PR04CA0117.namprd04.prod.outlook.com]
I have searched everywhere on Google but most of them have solution for gmail not office. So, I couldn't find the exact problem.