开发者

Rails: How to use a partial in multipart/alternative emails (HTML and plain text)

I use a partial in various multipart开发者_运维问答 emails (HTML and plain text) in Rails and have the following problem with it:

  • All email "views" exist normally: both in .text.plain.erb and .text.html.erb versions

  • The partial (which is located in the "shared" views folder), also exists in both versions using the required endings (as mentioned above).

The problem: In the "plain text" version of the received emails, it is the HTML partial that is rendered, not the "plain text" one. (Everything else is rendered correctly in both versions.)

What am I probably doing wrong?

Thanks a bunch for any help with this! Tom


I found the answer that works for me. PeterD posted the following on rails mailer with different layouts:

...the layouts follow a different naming scheme to the email templates. Just rename them as follows:

layout.text.html.erb    => layout.html.erb
layout.text.plain.erb   => layout.text.erb
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜