1

I'm having difficulties integrating Sendgrid with Rails 6, and I'm a bit lost at the moment because according to my terminal, emails are being sent to the corresponding email address.

OrderMailer#receipt: processed outbound mail in 17.9ms
Delivered mail 5f0b2c075e025_c1014870205f@aarons-macbook-pro.home.mail (8.1ms)
Date: Sun, 12 Jul 2020 17:28:07 +0200
From: john@anotherpin.com
To: *******@gmail.com
Message-ID: <5f0b2c075e025_c1014870205f@aarons-macbook-pro.home.mail>
Subject: Thank you for ordering from AnotherPin!
Mime-Version: 1.0
Content-Type: multipart/alternative;
 boundary="--==_mimepart_5f0b2c075ceb9_c10148702043a";
 charset=UTF-8
Content-Transfer-Encoding: 7bit


----==_mimepart_5f0b2c075ceb9_c10148702043a
Content-Type: text/plain;
 charset=UTF-8
Content-Transfer-Encoding: 7bit

Thank you for your order!
-------------------------

Order ID: 148


Name: John Doe


Total price: $18.00


Thanks for your support!


----==_mimepart_5f0b2c075ceb9_c10148702043a
Content-Type: text/html;
 charset=UTF-8
Content-Transfer-Encoding: 7bit

However, when I check the test email inbox, the messages are never received, even checking the spam folder.

I'm puzzled, because I'm not receiving any error messages in my rails console.

Here is what I've included in my development.rb:

  config.action_mailer.smtp_settings = {
  address:              'smtp.sendgrid.net',
  port:                 587,
  domain:               'john@anotherpin.com',
  user_name:             'apikey',
  password:              Rails.application.credentials[Rails.env.to_sym][:sendgrid_username],
  authentication:       'plain',
  enable_starttls_auto: true }

I know that as of April 2020, Sendgrid requires the verification of senders to use any of their services, so I've succesfully proceeded with doing so. Still, it appears that my messages are not being sent to the test email inbox's.

Does any have any idea why it might be that I see them being sent in my terminal, but not in my actual inbox.

Aaron Z
  • 73
  • 1
  • 5
  • Try to change `domain` to `anotherpin.com`, `username` to `Rails.application.credentials[Rails.env.to_sym][:sendgrid_username]` and `password` to a proper value. – Yakov Jul 12 '20 at 19:59
  • Hi Yakov, thanks for your suggestion! I actually solved the problem by - I realized that I had contradictory things related to setting the stmp --- One was the correct ` config.action_mailer.delivery_method = :smtp ` but the other item I had included in my development.rb was ` config.action_mailer.delivery_method = :test ` and I think this was confusing the system – Aaron Z Jul 13 '20 at 20:14

0 Answers0