Generate Email with Link

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 %>.

tashfeen.ekram wrote:

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 %>.

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: <%[email protected] %>

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs