Search code examples
ruby-on-railsactionmailersparkpost

Sparkpost Rails sending domain rejected


I am using this guide as a reference to set up ActionMailer for my Rails app but I am getting this error whenever I try to send a mail. I have also tried to copy using the same exact settings as the guide but I still get the same error.

550 5.7.1 Unconfigured Sending Domain <gmail.com>

I have properly configured my sending domain, for example myapp.com at Sparkpost which is marked as ready to send and this is my rails actionmailer settings under production and development settings for the rails app.

config.action_mailer.smtp_settings = {
user_name: 'SMTP_Injection',
password: 'my_api_key',
address: 'smtp.sparkpostmail.com',
port: 587,
enable_starttls_auto: true,
domain: 'myapp.com'

}

Solution

  • If you are using Devise for your Rails app, do not forget to configure your mailer sender settings for Devise in your config settings along with your smtp settings which was what I forgot to do.

    config.mailer_sender = your sending email address