Include dynamic info in Rails emails

Posted by Danny McClelland on Stack Overflow See other posts from Stack Overflow or by Danny McClelland
Published on 2010-04-28T20:48:07Z Indexed on 2010/04/28 21:27 UTC
Read the original article Hit count: 500

Hi Everyone,

I have managed to get my email problem sorted so now everytime a case is created an email goes out to the specified address.

I have a usermailer.rb

def makeakase(email, name, jobno, casesubject)
      recipients email
      from "no-reply@your_rails_app.com"
      subject "FW: Kase creation from Survey Manager"
      sent_on Time.now
      body :name => name
  end

and I have the kases_controller.rb:

if @kase.save
          UserMailer.deliver_makeakase("[email protected]", "Highrise")

In the body I would like to use the tags that I use in the kase show view such as:

<%=h @kase.jobno %> - <%=h @kase.casesubject %>

but they don't work, I get the following error:

wrong number of arguments (2 for 4)

Any ideas?

Thanks,

Danny

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about email