sinatraerbpony

How do I encourage Pony to NOT use my layout when using Pony to send an email using a template


I'm sending like this:

Pony.mail :to => 'me@mine.com.au',
        :from => 'me@mine.com.au',
        :subject => 'Howdy, Partna!',
        :body => erb(:email)

It's working really well, except the plain text email arrives full of the layout html

How do I tell it to not use the layout, just the email.erb template?


Solution

  • Like this

    set :erb, :layout => false
    body = erb (:_emailhtml )
    Pony.mail :to => 'will@kindleman.com.au',
            :from => 'will@kindleman.com.au',
            :subject => 'Howdy, Partna!',            
            :html_body => body
    

    Pony / ruby / sinatra didn't like putting the erb (:_emailhtml) direct into the options hash, and the layout file needed to be set before the erb method.

    yay.