第一次尝试从 Rails 发送电子邮件。它似乎工作所有期望电子邮件永远不会送达。
所以这是邮件程序类:
class UserMailer < ActionMailer::Base
default :from => "contact@triplingo.com"
def purchase_email(name, email, txid, itemname, code)
@name = name
@txId = txid
@itemName = itemname
@code = code
@email = email[1].gsub("%", "@")
mail(:to => @email, :subject => "Thank you for your purchase")
end
end
我在这里的控制器中调用它:
UserMailer.purchase_email(@name, @email, @txId, @itemName, @code).deliver
没有错误,事实上我在控制台中得到了很好的反馈:
Rendered user_mailer/purchase_email.html.erb (0.6ms)
Rendered user_mailer/purchase_email.text.erb (0.5ms)
Sent mail to ross@triplingo.com (25ms)
Date: Tue, 18 Oct 2011 14:40:03 -0400
From: contact@triplingo.com
To: ross@triplingo.com
Message-ID: <4e9dc803a34b2_1f83ffc0d5d19f4487bd@RossRankins-MacBook-Pro.local.mail>
Subject: Thank you for your purchase
Mime-Version: 1.0
Content-Type: multipart/alternative;
boundary="--==_mimepart_4e9dc8038ee3f_1f83ffc0d5d19f4484b3";
charset=UTF-8
Content-Transfer-Encoding: 7bit
----==_mimepart_4e9dc8038ee3f_1f83ffc0d5d19f4484b3
Date: Tue, 18 Oct 2011 14:40:03 -0400
Mime-Version: 1.0
Content-Type: text/plain;
charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-ID: <4e9dc803a179e_1f83ffc0d5d19f448553@RossRankins-MacBook-Pro.local.mail>
-<snip>-
----==_mimepart_4e9dc8038ee3f_1f83ffc0d5d19f4484b3
Date: Tue, 18 Oct 2011 14:40:03 -0400
Mime-Version: 1.0
Content-Type: text/html;
charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-ID: <4e9dc803a27fc_1f83ffc0d5d19f44864b@RossRankins-MacBook-Pro.local.mail>
<!DOCTYPE html>
<html>
-<snip>-
----==_mimepart_4e9dc8038ee3f_1f83ffc0d5d19f4484b3--
那么如何开始诊断问题呢?谢谢!