5

マルチパートメールで Rails ActionMailer を使用しているときに、両方を作成しました。

approval_trade_email.html.erb

approval_trade_email.text.erb

メール クライアント (Mac OSX) で適切に HTML 形式のメールを受信しましたが、Gmail アカウントで同じメールをチェックすると、マルチパートが含まれる無名の添付ファイルを含む空の本文が表示されました。

ヘルプ?

Gmail でこれを取得するのはなぜですか?

どうも

ジョエル

ここに、GMAIL の noname 添付ファイルがあります。

----==_mimepart_4eab3a61bb3a8_10583ff27b4e363c43018
Date: Sat, 29 Oct 2011 01:27:29 +0200
Mime-Version: 1.0
Content-Type: text/plain;
 charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Content-ID: <4eab3a61bc857_10583ff27b4e363c43191@joel-maranhaos-macbook-pro.local.mail>


Do not to forget to make a donation on our Site: /home/index?path_only=false


----==_mimepart_4eab3a61bb3a8_10583ff27b4e363c43018
Date: Sat, 29 Oct 2011 01:27:29 +0200
Mime-Version: 1.0
Content-Type: text/html;
 charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Content-ID: <4eab3a61bd5fa_10583ff27b4e363c432cb@joel-maranhaos-macbook-pro.local.mail>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>  
<link href="/assets/powerplants.css" media="screen" rel="stylesheet" type="text/css" />

</head>
<body id="email">      

<p><b>Do not to forget to make a donation on our <a href="/home/index?path_only=false">Site</a>.</b></p>

</body>
</html>
----==_mimepart_4eab3a61bb3a8_10583ff27b4e363c43018--
4

1 に答える 1

1

私は同じ問題を抱えており、解決策を見つけました:

これは Rails 3 の古い ActionMailer API のバグで、メール ヘッダーにマルチパート境界定義が含まれていません。

参照: https://github.com/rails/rails/pull/3090

新しいAPIを使用するだけです(mailメソッドを使用)

class UserMailer < ActionMailer::Base
  default :from => "notifications@example.com"

  def welcome_email(user)
    @user = user
    @url  = "http://example.com/login"
    mail(:to => user.email, :subject => "Welcome to My Awesome Site")
  end
end
于 2012-02-23T15:27:15.073 に答える