在Rails App中的localhost中显示电子邮件.sent中所需字体的字体

时间:2012-07-30 15:03:41

标签: ruby-on-rails actionmailer

我有一个rails应用程序,我想在其中发送电子邮件,并在某些文本上应用字体。这些字体文件在我的服务器上。

我在我的application.rb中尝试了这些设置

config.assets.paths << Rails.root.join("app", "assets", "fonts")
config.assets.precompile += %w( .svg .eot .woff .ttf )

然后在电子邮件的HTML模板中的样式标记中使用字体代码。

@font-face {
font-family: 'TestFont';
src: url('<%= root_url%>assets/test-webfont.eot');
src: url('<%= root_url%>assets/test-webfont.eot?#iefix') format('embedded-opentype'),
     url('<%= root_url%>assets/test-webfont.woff') format('woff'),
     url('<%= root_url%>assets/test-webfont.ttf') format('truetype'),
     url('<%= root_url%>assets/test-webfont.svg#MelbourneRegular') format('svg');
font-weight: normal;
font-style: normal;
}

但这些字体文件对发送的电子邮件没有影响。 我也尝试将字体文件放在public / fonts文件夹中,但没有成功。

感谢任何建议或帮助。

1 个答案:

答案 0 :(得分:0)

谢谢大家。

我还检查了这个http://kb.mailchimp.com/article/can-i-upload-or-use-my-own-custom-fonts/。 因此,将使用Image而不是字体。