以下问题:每当我尝试通过导轨发送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