开发者

Adding custom META tag to ActionMailer email in Rails 2.3.8?

I'm sending an email using an ActionMailer class in Rails 2.3.8. I need to add a META tag to the HEAD of the email. Specifically, I want to add this (ultimately for handling special CSS3 on mobile devices):

<meta name="viewport" content="width=device-width" />

I can't find a way to add this to the HEAD section 开发者_StackOverflow中文版of the email. Do I need to create a custom email layout that I use? If so, how do I do that? It seems like there should be an easier way than creating a custom layout.


It sounds like you want to send a HTML email and set the meta tag in the view. Try updating your ActionMailer content-type with something like:

class Notifier < ActionMailer::Base
  default 'content-type' => 'text/html'
end

Then add the following line to your view's layout or <head> section:

<meta name="viewport" content="width=device-width" />
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜