Rails HTML / TEXT UserMailer模板 [英] Rails HTML/TEXT UserMailer Templates

查看:76
本文介绍了Rails HTML / TEXT UserMailer模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前对于我的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模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆