'Rails "550 5.7.60 SMTP; Client does not have permissions to send as this sender [RO1PR80MB1382.lamprd80.prod.outlook.com]"

I use devise and this error occurs when devise try to send email to confirm user's email.

Follow below my development.rb which

development.rb

  # Email
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.default_url_options = { host: 'domain.com' }  
  config.action_mailer.perform_deliveries = true
  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.asset_host = 'badoda.com'

  config.action_mailer.smtp_settings = {
    :address              => 'outlook.office365.com',
    :port                 => 587,
    :user_name            => '[email protected]',
    :password             => 'password',
    :domain               => 'domain.com',
    :authentication       => :login,
    :enable_starttls_auto => true
  }  


Solution 1:[1]

It seems to be an issue with Office 365 SMTP relay configuration. Please follow the steps here to configure SMTP properly.

Solution 2:[2]

Does your MIME message specify the right Sender header?

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Pranav Prakash
Solution 2 Dmitry Streblechenko