I would like send email with html.erb template and I have some code. Like this:
class Mailer < ActionMailer::Base
  def notification(to_email)
    begin
      mail(to: '[email protected]', subject: "Test message")
      rescue Exception => e
      return
    end
  end
end
And some html.erb file:
Hello, <%= @name %>.
But I don't know how to attach this template for my method. Help me please with this issue, because i can't fount normally manual about it.
                        
You can create a page named
notification.html.erbinapp/views/mailerdirectory. You will get all instance variable innotification.html.erbthat is defined in yourdef notification(to_email)Now
@namewill be available innotification.html.erblike