Generate Email with Link

5 views
Skip to first unread message

tashfeen.ekram

unread,
Aug 21, 2009, 7:47:49 PM8/21/09
to Ruby on Rails: Talk
I am getting confused on how to do this. I want to send a link in an
email that they can click on. I am confused on whther to use link_to
vs url_for. I would also like to pass in a addional param in the
link.

Link_to only generates text not a link.

This the definition in the model ActionMailer.

def emailactivate(reminderinfo)

recipients reminderinfo.email

subject "Activation Link for your DrugBin Reminders"

body :reminderinfo => reminderinfo
content_type "text/html"

end

emailactivate.rhtml (is there a difference in putting this as a
emailactivate.html.erb)

<%= url_for(:host => APP_CONFIG['settings']['domain'], :controller =>
'/user/dashboard', :action => 'activateemail', :id =>
@reminderinfo.id, :code => @reminderinfo.confirmation ) %>.

<%= link_to "Confurm", :controller => '/user/dashboard', :action =>
'activateemail', :id => @reminderinfo.id, :code =>
@reminderinfo.confirmation %>.

Rails List

unread,
Aug 21, 2009, 9:59:30 PM8/21/09
to rubyonra...@googlegroups.com

I would do this way

In your Action Mailer
def activateemail(blah,blah)
@body[:activateurl] =
"#{SITEURL}/activate/#{classified.activation_code}"
end

In Your activateemail.html.erb

Activate using the link: <%=@activateurl %>

--
Posted via http://www.ruby-forum.com/.

Reply all
Reply to author
Forward
0 new messages