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

StackOverflow https://stackoverflow.com/questions/12636569

  •  04-07-2021
  •  | 
  •  

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?

有帮助吗?

解决方案 2

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.

其他提示

Pony.mail :to => 'me@mine.com.au',
    :from => 'me@mine.com.au',
    :subject => 'Howdy, Partna!',
    :body => erb(:email, layout: false)
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top