以下問題:每當我嘗試通過導軌發送HTML電子郵件時,它都以內容爲附件的空電子郵件到達我的googlemail-address。通過rails發送的HTML電子郵件以附件的形式到達
我不太確定我在做什麼錯在這裏。
設置如下:
/app/mailers/testmail.rb
class Testmail < ActionMailer::Base
default :from => "[email protected]"
default_url_options[:host] = '10.10.8.1'
def email
subject 'Willkommen!'
recipients '[email protected]'
from '[email protected]'
sent_on Time.now
end
end
/app/views/testmail/email.html.erb
<p>Dies ist eine <strong>Testmail!</strong></p>
/app/views/testmail/email.text.erb
Dies ist eine Test-Email!
這是我Googlemail電子郵件賬戶什麼到達:
第一封電子郵件是什麼樣子與該html.erb和文本.erb激活,第二個只有text.erb。 忽略用戶名「根」,這是由於後綴重寫,因爲實際的郵件是另一臺服務器上的(從軌服務器的郵件發送給哪個然後實際郵件他們的郵件服務器 - 不是我的設置;)
下面是從第一封電子郵件的原始數據:
Delivered-To: [email protected]
Received: by 10.101.108.3 with SMTP id k3cs279048anm;
Wed, 21 Sep 2011 04:24:29 -0700 (PDT)
Received: by 10.204.134.8 with SMTP id h8mr508445bkt.11.1316604268267;
Wed, 21 Sep 2011 04:24:28 -0700 (PDT)
Return-Path: <[email protected]_server>
Received: from our_server (our_server. [100.0.0.0])
by mx.google.com with ESMTP id i7si2877863bke.151.2011.09.21.04.24.27;
Wed, 21 Sep 2011 04:24:28 -0700 (PDT)
Received-SPF: neutral (google.com: 100.0.0.0 is neither permitted nor denied by best guess record for domain of [email protected]_server) client-ip=100.0.0.0;
Authentication-Results: mx.google.com; spf=neutral (google.com: 100.0.0.0 is neither permitted nor denied by best guess record for domain of [email protected]_server) [email protected]_server
Received: from zero (our_server [100.0.0.1])
by our_server (Postfix) with SMTP id 4251724B65
for <[email protected]>; Wed, 21 Sep 2011 13:24:26 +0200 (CEST)
Received: by zero (sSMTP sendmail emulation); Wed, 21 Sep 2011 13:24:26 +0200
From: "root" <[email protected]_server>
Date: Wed, 21 Sep 2011 13:24:25 +0200
To: [email protected]
Message-ID: <[email protected]_router.mail>
Subject: Willkommen!
Mime-Version: 1.0
Content-Type: multipart/alternative
Content-Transfer-Encoding: 7bit
----==_mimepart_4e79c96a1adc0_2ba53f7fe85ced90437f9
Date: Wed, 21 Sep 2011 13:24:26 +0200
Mime-Version: 1.0
Content-Type: text/plain;
charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Content-ID: <[email protected]_router.mail>
Dies ist eine Test-Email!
----==_mimepart_4e79c96a1adc0_2ba53f7fe85ced90437f9
Date: Wed, 21 Sep 2011 13:24:26 +0200
Mime-Version: 1.0
Content-Type: text/html;
charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Content-ID: <[email protected]_router.mail>
<p>Dies ist eine <strong>Testmail!</strong></p>
----==_mimepart_4e79c96a1adc0_2ba53f7fe85ced90437f9--
嗯,我發現這個錯誤報告:https://rails.lighthouseapp.com/projects/8994/tickets/6657然而,我沒有找到一個結論說,錯誤... – Rhywden
對於後代,上述燈塔票被遷移到https://github.com/rails/rails/issues/985,關閉,並由@Rhywden作爲https://github.com/rails/rails/pull/3090重新打開,並以相同的分辨率關閉作爲Rhywden的解決方案:不要使用舊的API,它在Rails 3.2中被刪除了。 – Yogh