I currently have the code below in my html which gets sent as an email. I would like for it to say here as a hyperlink. I have seen and know how to do
Ok so assuming you have an ActionMailer called MyMailer, with a single method send_link. Just as you would for a controller action, set any instance variables within the send_link method to be used by the email view for rendering.
class MyMailer < ActionMailer::Base default from: 'email@example.com' def send_link(user, host) @user = user @host = host mail(to: user.email, subject: "Here is your link") end end
Next create a view for this just as you would for a controller actions views and write your html with any necessary erb.
<p>Dear <%= @user.forename %>,</p> <p>Here is your link</p> <p><%= link_to 'Click Me', landlord_page_url(@user, host: @host) %></p>
And you are done.