Rails邮件程序样式

bra*_*r19 3 css haml ruby-on-rails sass actionmailer

为什么我在邮件上收到默认样式邮件?在代码中我有点风格,但为什么在gmail上我看到默认布局?我的代码是这样的:

!!!
%html
  %head
    %meta{:content => "text/html; charset=utf-8", "http-equiv" => "Content-Type"}
      %title ??????? ?????????????
      :css
        body, td { background-color:#cecece; color:#000000; font-size:14px; font-family:Verdana,Helvetica,Arial; }
        .blue { background-color: blue; height:2px; color: white; }
        .notice {margin: 10px auto;  background-color: #fbb752;  border: 1px solid #cecece; }
  %body
    .blue
      %h3
        ????? ?????
      %b
        ????????, ??????? ?? ????? ??????????? ????? ?????!
        = @order.id
    .notice
      %table
        %tr
          %th
            id ???????
          %th
            ?????
          %th
            ??????
          %th
            ????? ?????
          %th
            ??????
          %th
            ??????
        %tr
          %td
            = @order.user.id
            = @order.user.email
          %td
            %b
              = @order.street
          %td
            = @order.building
          %td
            %b
              = @order.totalcost
          %td
            %b
              = @order.orderstatus.name
          %td
            = @order.created_at
      %br/
      %table
        %tr
          %th
            ???????
          %th
            ????
          %th
            ??????????      
        - @order.line_items.each do |l|
          %tr{ :class => cycle("zebra-stripe zebra-grey zebra1", "zebra-stripe zebra-grey zebra2")}      
            %td
              = l.description
            %td
              = l.price
            %td
              = l.quantity
Run Code Online (Sandbox Code Playgroud)

那么怎么办,我的邮件发送我的电子邮件服务(gmail)好样式字母,如我的代码?

SLa*_*aks 7

Gmail会<style>从HTML电子邮件中删除所有代码.

如果您希望样式显示在Gmail中,则需要使用内联样式属性.