Do you have action mailer instance under model folder? Have defined
methods within it?
Here is a brief;
ruby script/generate mailer Notify
This should generate the following in your model directory and under
folder in your view.
class Notify < ActionMailer::Base
end
now, you define methods with in models/notify.rb
class Notify < ActionMailer::Base
def notifycustomer(blahh, blah) @subject = “Message from a visitor” @recipients = blahh.email @from = blah[:email] @sent_on = Time.now @body[“title”] = blah[:msg]
end
end
in your controllers action you would trigger it
def sendmail2customer
Notify.deliver_notifycustomer(@blahh, params[:blah])
end
in your view, you will have sendmail2customer.html.erb which might have
===============================================================================
Hi!
You are having one email message from <%= @email %> with a title
<%= @title %>
and following is the message: Confirm
Thanks
=============================================================================
I am getting this
Hi!
You are having one email message from [email protected] with a title
Confirmation
and following is the message: Confirm
Thanks
def notifycustomer(blahh, blah) @subject = “Message from a visitor” @recipients = blahh.email @from = blah[:email] @sent_on = Time.now @body[“title”] = blah[:title] #now you can use @title in your view @body[“msg”] = blah[:msg] # now you can use @msg in your view @body[“url”] = “some url” # now you can use @url in your view
end
if you have followed my sample code then your view should have
Hi!
You are having one email message from <%= @email %> with a title
<%= @title %>
and following is the message:
<%= @msg %>
url: <%= @url %>
Thanks
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.