3

メールにデフォルトスタイルのメールが届くのはなぜですか?コードでは少しスタイルを設定していますが、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

では、どのようにすれば、私のメーラーは私のコードのように私の電子メールサービス(gmail)に良いスタイルの文字を送信するのでしょうか?

4

1 に答える 1

8

Gmailは<style>、HTMLメールからすべてのタグを削除します。

Gmailにスタイルを表示する場合は、インラインスタイル属性を使用する必要があります。

于 2012-12-19T14:09:15.740 に答える