ruby-on-railssendinblue

Rails, transactional email and sender validation


I would like to use Sendinblue to send transactional email from my Rails web application.
To configure my application to use Sendinblue I edited config/environments/production.rb as follows (NOTE: fireworks.com is just an example):

Rails.application.configure do
  ...
  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.delivery_method = :smtp
  host = 'fireworks.com'
  config.action_mailer.default_url_options = { host: host }
  ActionMailer::Base.smtp_settings = {
    :address        => 'smtp-relay.sendinblue.com',
    :port           => '587',
    :authentication => :plain,
    :user_name      => ENV['SENDINBLUE_USERNAME'],
    :password       => ENV['SENDINBLUE_PASSWORD'],
    :domain         => 'fireworks.com',
    :enable_starttls_auto => true
  }
  ...
end

Do I need any gem, like sib-api-v3-sdk?
I suppose this gem is useful only for sending email using the Sendinblue API.

At Sendinblue I authenticated my domain 'fireworks.com' and created a sender, noreply@fireworks.com, which I would use for account activation.

app/mailers/application_mailer.rb

class ApplicationMailer < ActionMailer::Base
  default from: "noreply@fireworks.com"
  layout 'mailer'
end

In order for me to use this sender, Sendinblue wants me to verify (or validate) it.
Now the point is that noreply@fireworks.com does not exist. Michael Hartl in his tutorial uses noreply@example.com, I would use noreply@fireworks.com because I own the fireworks.com domain.
Since I would not be able to validate the sender, I thought that the only solution would be creating in my server the noreply user account, configuring Postfix to receive email from Internet and adding an MX record to my DNS zone.
I would maintain this configuration until I receive the validation email.
Is this solution necessary? Do I have any other choice?


Solution

  • Now the point is that noreply@fireworks.com does not exist.

    Before continuing, I want to point out that this is ultimately not a good practice. You'll want some address to receive and recognize bounces.

    Having said that, I just checked their documentation and it says here that instead of validating individual email addresses, you can just validate the whole domain via DNS entry, file upload or by sending them an email.