Using templates for Pony gem
-
06-06-2021 - |
Pergunta
I recently came across sending emails via Rails. After watching railcast, it seems that you can write up a template when using Action Mailer. I really liked this feature for my purpose. I also came across Pony, which seems really easy to use.
I was wondering if I can use templates for sending emails via Pony, unless Pony is meant for express non-templated emails.
Solução
In my research, Pony seems to be promoted as a non-template based tool, making it "simpler" to use. The home page for the utility does not mention templates at all: https://github.com/benprew/pony
Outras dicas
You can easily access the view framework by explicitly rendering a template:
Pony.mail(
:to => 'somewhere@example.com',
:from => 'sender@other.example.com',
:subject => 'an example',
:body => render_to_string("path/to/_partial", :locals => {foo: @foo}, :layout => false)
)
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow