firstruby

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] = request.host
or
ActionMailer::Base.default_url_options[:host] = request.host_with_port

Hope this will be helpful for someone.

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

 
%d bloggers like this: