Master ruby with us

Set default host for Mailer in RubyonRails

Posted by firstruby on October 16, 2009

We can set the default host for all of our methods in Mailer.

For this, we need to write one method in ApplicationController file with following code and call this method using before_filter,

ActionMailer::Base.default_url_options[:host] =
ActionMailer::Base.default_url_options[:host] = request.host_with_port

Hope this will be helpful for someone.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: