问题描述
当前对于我的Rails 3邮件模板,我需要在<$中创建 html
和 text
版本c $ c> views / user_mailer目录。
Currently for my Rails 3 mailer templates, I need to create an html
and text
version in the views/user_mailer directory
.
为什么有必要?为什么Rails无法查看 html
版本并将其自动格式化为 text / plain
版本?
Why is that necessary? Why can't rails look at the html
version and automatically format it to a text/plain
version?
推荐答案
这不是必需的。您只需提供这些模板之一即可。例如,如果您不需要HTML,则只能创建TEXT文件。
This is not required. You can simply provide one of those templates. For instance, if you don't need HTML, you can create the TEXT file only.
同样,您只能提供HTML模板。读者将尝试提取信息。
但是,如果您使用HTML,则应应该提供另一种TEXT版本,以确保读者不会弄乱您电子邮件的内容。
Likewise, you can provide the HTML template only. Readers will attempts to extract the information.However, if you use HTML, you should provide an alternative TEXT version to make sure the readers won't mess the content of your email.
顺便说一句,Rails不会强迫您提供两个模板。
By the way, Rails doesn't force you to provide both templates.
这篇关于Rails HTML / TEXT UserMailer模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!