3

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'

}
Wraithseeker
  • 1,884
  • 2
  • 19
  • 34

3 Answers3

5

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

Wraithseeker
  • 1,884
  • 2
  • 19
  • 34
2

The problem is not in your rails code

Here is a SparkPost article answers your question

The message will be rejected if you are sending from a domain that you have not yet added or configured. Please go to https://app.sparkpost.com/#/account/sending-domains to configure your domain.

Unverified Sending Domain: The message will be rejected if you are sending from a domain that has been configured but not yet verified.

Please visit this official link for reference

  • I have already configured my sending domain (myapp.com) at Sparkpost SPF for the DKIM records and it is marked as ready to send. So that should not be the problem – Wraithseeker Jan 23 '16 at 09:09
  • May be it might not been approved yet, the reason why i am beliving the problme is on the sparkpost side is , the error message itself clearly stating this ``Unconfigured Sending Domain`` which rails never throw – Ramesh Kumar Thiyagarajan Jan 23 '16 at 09:11
  • 2
    I have figured out the problem, the problem was that my Devise settings in Rails was not configured properly in the initializer – Wraithseeker Jan 23 '16 at 09:21
0

You have to follow this https://support.sparkpost.com/customer/portal/articles/1933318-creating-sending-domains. BTW, I created this gem https://github.com/dmitrypol/sparkpost to interact with Sparkpost API. Note of caution - it's pretty beta/alpha quality.

Dmitry Polyakovsky
  • 1,535
  • 11
  • 31