How To Retrieve Server Address

How to retrieve server address in rails so that in the mail option I get http://serverIP:300/controller/action rather than http://localhost:3000/controller/action

In /config/environments/{development|test|production}.rb

config.action_mailer.default_url_options = {:host=>"serverIP", :port=>300}