ruby on rails - Net::SMTPAuthenticationError (535 5.7.3 Authentication unsuccessful while sending email using Action Mailer and office 365 email -
i have code on production.rb , 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: "username@mydomain.com", password: "password", enable_starttls_auto: true, openssl_verify_mode: 'none' }
i trying send mail office 365 mail account using action mailer. sends mail fine on localhost. raises following error during production. 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 of them have solution gmail not office. so, couldn't find exact problem.
actionmailer::base.smtp_settings = { address: env['smtp_address'], port: env['smtp_port'], domain: env['smtp_domain'], authentication: 'login', enable_starttls_auto: true, user_name: env['smtp_username'], password: env['smtp_password'] }
i have office 365 account working above settings.
the other thing got me need send actual account you're using log in with. example, don't send email noreply@brownwebdesign.com , use support@brownwebdesign.com smtp_username.
more info here: https://www.brownwebdesign.com/blog/connecting-rails-to-microsoft-exchange-smtp-email-server
Comments
Post a Comment