Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The addon: sendgrid in heroku have some issues #36

Open
jun-jing opened this issue May 31, 2021 · 3 comments
Open

The addon: sendgrid in heroku have some issues #36

jun-jing opened this issue May 31, 2021 · 3 comments

Comments

@jun-jing
Copy link

I am at chapter 11 of the whole book, the local part is okay, but when moving to the production site, when adding on the SendGrid to the production, things happened below:

2021-05-31T03:31:15.411568+00:00 app[web.1]: <h1>Sample App</h1>
2021-05-31T03:31:15.411569+00:00 app[web.1]: <p>Hi jessezhang,</p>
2021-05-31T03:31:15.411569+00:00 app[web.1]: <p>
2021-05-31T03:31:15.411569+00:00 app[web.1]: Welcome to the Sample App! Click on the link below to activate your account:
2021-05-31T03:31:15.411570+00:00 app[web.1]: </p>
2021-05-31T03:31:15.411570+00:00 app[web.1]: <a href="https://peaceful-lake-58934.herokuapp.com/account_activations/tYhSpsIOZoizx1tW4W7Kfg/edit?email=jessejunjing2%40163.com">Activate</a>
2021-05-31T03:31:15.411571+00:00 app[web.1]: </body>
2021-05-31T03:31:15.411571+00:00 app[web.1]: </html>
2021-05-31T03:31:15.411571+00:00 app[web.1]: 
2021-05-31T03:31:15.411572+00:00 app[web.1]: ----==_mimepart_60b4588357a2f_92b1eb836e578698e8--
2021-05-31T03:31:15.411572+00:00 app[web.1]: 
2021-05-31T03:31:15.412252+00:00 app[web.1]: I, [2021-05-31T03:31:15.412183 #9]  INFO -- : [6e653373-0a7f-4b22-80e6-fd1e0405431e] Completed 500 Internal Server Error in 982ms (ActiveRecord: 31.5ms | Allocations: 6501)
2021-05-31T03:31:15.413372+00:00 app[web.1]: F, [2021-05-31T03:31:15.413300 #9] FATAL -- : [6e653373-0a7f-4b22-80e6-fd1e0405431e]
2021-05-31T03:31:15.413373+00:00 app[web.1]: [6e653373-0a7f-4b22-80e6-fd1e0405431e] Net::SMTPAuthenticationError (535 Authentication failed: account disabled
2021-05-31T03:31:15.413374+00:00 app[web.1]: ):
2021-05-31T03:31:15.413374+00:00 app[web.1]: [6e653373-0a7f-4b22-80e6-fd1e0405431e]
2021-05-31T03:31:15.413374+00:00 app[web.1]: [6e653373-0a7f-4b22-80e6-fd1e0405431e] app/models/user.rb:68:in `send_activation_email'
2021-05-31T03:31:15.413375+00:00 app[web.1]: [6e653373-0a7f-4b22-80e6-fd1e0405431e] app/controllers/users_controller.rb:30:in `create'
2021-05-31T03:31:15.415104+00:00 heroku[router]: at=info method=POST path="/users" host=peaceful-lake-58934.herokuapp.com request_id=6e653373-0a7f-4b22-80e6-fd1e0405431e fwd="47.241.19.216" dyno=web.1 connect=1ms service=990ms status=500 bytes=1891 protocol=https

I double-checked the code in my production.rb file, I think they are fine:

  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.delivery_method = :smtp
  host = 'peaceful-lake-58934.herokuapp.com' # Don't use this literally; use your local dev host instead
  config.action_mailer.default_url_options = { host: host, protocol: 'https' }
  ActionMailer::Base.smtp_settings = {
    address: 'smtp.sendgrid.net',
    port: '587',
    authentication: :plain,
    user_name: ENV['SENDGRID_USERNAME'],
    password: ENV['SENDGRID_PASSWORD'],
    domain: 'heroku.com',
    enable_starttls_auto: true
  }

And I also checked several StackOverflow Q&As, it looks like the SendGrid add-on on Heroku is becoming hard to use recently(from when I am not sure). I then try to sign up by my own email on SendGrid, it is also failed, the SendGrid login page keeps telling me that I am not authorized and I should call the support(some advice like that).
Anyway, I guess I should let you(the author) know the situation.
Or is my assumption is wrong, or there are some fault steps in my code when learning your materials, I am not sure.
Anyway, I will keep learning this material and just ignore this part now.

Thanks again for the brilliant ruby on rails tutorial materials.

@mhartl
Copy link
Collaborator

mhartl commented May 31, 2021

Thanks for the heads-up. There have been some ongoing issues with SendGrid, but I believe they have been resolved in the latest edition of the book. See the blog post Sending Email with Rails for the details, including an important reference to SendGrid’s Single Sender Verification page. The latest version of Section 11.4: Email in production includes the steps for how to set that up.

If you continue to have trouble, please file a customer support ticket with SendGrid and send me the ticket number. I can then alert SendGrid about the ticket on your behalf.

@jun-jing
Copy link
Author

jun-jing commented Jun 1, 2021 via email

@jun-jing
Copy link
Author

jun-jing commented Jun 17, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants