Ask A Question

Notifications

You’re not receiving notifications from this thread.

Sendgrid / Mailer Issue

Red Hendery asked in General

Hello,

I run a website and I am having issues generating mailer links correctly, when a User signs up they must verify their email address. This all works as expected, mailer sends the email and it gets received.

The site is hosted on Heroku, when I view the logs they contain the route as I would expect, but in the email the link starts https://u9805564.ct.sendgrid.net which is tied to the Sender Authentication I was required to do.

Unsure what code is going to be helpful but happy to post anything requested.

#config/production.rb

  config.action_mailer.perform_caching = false
  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.default_url_options = { protocol: 'https', host: 'marincricketclub.com' }

  ActionMailer::Base.smtp_settings = {
    :address        => 'smtp.sendgrid.net',
    :port           => '587',
    :authentication => :plain,
    :user_name      => 'apikey',
    :password       => ENV['SENDGRID_API_KEY'],
    :domain         => 'heroku.com',
    :enable_starttls_auto => true
  }

I am open to using a Sendgrid alternative, just needs to be cheap as we are going to send maybe 1000 emails a year.

Reply

Issue was being caused by a Click Tracking setting in SendGrid, URL's display correctly now but do not activate account in production. Heroku log below:

2021-04-04T17:28:35.393591+00:00 heroku[router]: at=info method=GET path="/" host=www.marincricketclub.com request_id=acdf2f79-632b-4732-9af4-a9578fe7b512 fwd="73.109.31.45" dyno=web.1 connect=0ms service=11ms status=200 bytes=5322 protocol=https
2021-04-04T17:28:35.383993+00:00 app[web.1]: I, [2021-04-04T10:28:35.383892 #4]  INFO -- : [acdf2f79-632b-4732-9af4-a9578fe7b512] Started GET "/" for 73.109.31.45 at 2021-04-04 10:28:35 -0700
2021-04-04T17:28:35.385055+00:00 app[web.1]: I, [2021-04-04T10:28:35.384970 #4]  INFO -- : [acdf2f79-632b-4732-9af4-a9578fe7b512] Processing by StaticPagesController#home as HTML
2021-04-04T17:28:35.386143+00:00 app[web.1]: D, [2021-04-04T10:28:35.386060 #4] DEBUG -- : [acdf2f79-632b-4732-9af4-a9578fe7b512]   Rendering layout layouts/application.html.erb
2021-04-04T17:28:35.386244+00:00 app[web.1]: D, [2021-04-04T10:28:35.386178 #4] DEBUG -- : [acdf2f79-632b-4732-9af4-a9578fe7b512]   Rendering static_pages/home.html.erb within layouts/application
2021-04-04T17:28:35.386830+00:00 app[web.1]: I, [2021-04-04T10:28:35.386749 #4]  INFO -- : [acdf2f79-632b-4732-9af4-a9578fe7b512]   Rendered static_pages/home.html.erb within layouts/application (Duration: 0.5ms | Allocations: 99)
2021-04-04T17:28:35.387808+00:00 app[web.1]: D, [2021-04-04T10:28:35.387718 #4] DEBUG -- : [acdf2f79-632b-4732-9af4-a9578fe7b512]   Rendered layouts/partials/_rails_default.html.erb (Duration: 0.7ms | Allocations: 220)
2021-04-04T17:28:35.389017+00:00 app[web.1]: D, [2021-04-04T10:28:35.388933 #4] DEBUG -- : [acdf2f79-632b-4732-9af4-a9578fe7b512]   Rendered layouts/partials/_navbar.html.erb (Duration: 1.0ms | Allocations: 273)
2021-04-04T17:28:35.389398+00:00 app[web.1]: D, [2021-04-04T10:28:35.389316 #4] DEBUG -- : [acdf2f79-632b-4732-9af4-a9578fe7b512]   Rendered layouts/partials/_footer.html.erb (Duration: 0.1ms | Allocations: 19)
2021-04-04T17:28:35.389527+00:00 app[web.1]: I, [2021-04-04T10:28:35.389440 #4]  INFO -- : [acdf2f79-632b-4732-9af4-a9578fe7b512]   Rendered layout layouts/application.html.erb (Duration: 3.3ms | Allocations: 819)
2021-04-04T17:28:35.389905+00:00 app[web.1]: I, [2021-04-04T10:28:35.389815 #4]  INFO -- : [acdf2f79-632b-4732-9af4-a9578fe7b512] Completed 200 OK in 5ms (Views: 3.9ms | ActiveRecord: 0.0ms | Allocations: 1223)
2021-04-04T17:28:35.529104+00:00 heroku[router]: at=info method=GET path="/packs/css/application-1ede7797.css" host=www.marincricketclub.com request_id=f7590cd2-5713-4d53-a226-51c9565508df fwd="73.109.31.45" dyno=web.1 connect=0ms service=3ms status=304 bytes=112 protocol=https
Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 87,563+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.