What's the best way to pass in the domain name of your rails server for mailing?
dns, email, ruby, ruby-on-rails
Solution
I usually just pass the value of `request.host` in to the ActionMailer method.
Problem
I have an app that has is up in a few environments i.e. (development, staging, beta, live) What's the best way to pass in an app's domain name when sending mail, to allow for different domain names depending on the server? My first thought is to add something in the respective environment.rb files for each one, so `config/environments/beta.rb` would contain ``` ActionMailer::Base.smtp_settings[:domain] = 'beta.domain.com' ``` And `config/environments/staging.rb` would contain ``` ActionMailer::Base.smtp_settings[:domain] = 'staging.domain.com' ``` This feels like I'm doing something so basic that Rails would already have this value lying around, but I haven't found it in any of the places I would normally expect, nor can i find it in the documentation. What's the best approach to take here?