pip36
pip36

Reputation: 126

Deploying rails app to heroku, sendgrid email links not viable

I am working my way through the Michael Hartl rails tutorial, and am currently in the process of pushing the web app to Heroku. (app functions correctly in local server)

I am using sendgrid to facilitate sending email to users to activate accounts. When a user creates an account the email sends correctly and is received by the user. The reset link however does not function.

On the local server the email produces a link with url localhost:3000/ etc.... which works fine.

However on the heroku deployment, the link within the email produces HTML codes for the symbols "<" and ">". Enclosing the url within them like so....

http://<app-1234>.heroku-app.com/ etc...

which does not function as a valid link. Removing the "<>" tags manually causes the activation link to function.

I assume there is some setting within sendgrid I can alter to prevent the "<>" tags being added to the url but I am having no luck finding an answer. I hope my question is clear? Many Thanks in advance!

Upvotes: 2

Views: 215

Answers (2)

Rush0312
Rush0312

Reputation: 159

Suppose you have the link @url = "http://<app-1234>.heroku-app.com/users/sign_in". In the next line edit this @url with using gsub method which is used to modify and replace characters of string. Do @url.gsub!("<app-1234>", "app-1234") and then send that new @url object to user.

Upvotes: 1

Ryan Murphy
Ryan Murphy

Reputation: 842

When it says to enter

    host = <your heroku app>.herokuapp.com 

in the config/environments/production.rb file, don't actually put the < and > symbols. Just put the name of your app.

You would put:

    host = 'app-1234.herokuapp.com'

Upvotes: 3

Related Questions