I have two places where I deploy my application on heroku.
Both are production.
One is for staging and testing. The other is the live public application.
I know how to test the Rails env to see if its production or development.
Is there a way to test where the application is deployed so I can set up my sendgrid smtp settings for each environment and test the mail settings.
Your best bet is to use the Rails env for what it was intended. You can simply create a new file in your config/environments folder named staging.rb and copy your production settings into it but change any variables that you need to for your staging/testing application deployment.
Once you’ve done that set the heroku RAILS_ENV (via
heroku config add RAILS_ENV=staging) config variable on Heroku to ‘staging’ and it would use that file and have the smtp settings relevant to that environment loaded.Read more about config variables (which may also be used for SMTP settings) at http://devcenter.heroku.com/articles/config-vars