我設置了ActionMailer 3.x以供在Rails之外使用,但電子郵件沒有正文。誰能幫忙?ActionMailer without Rails - 視圖未被拾取
# ./app.rb
require 'action_mailer'
ActionMailer::Base.delivery_method = :file
ActionMailer::Base.file_settings[:location] = './tmp/mails'
ActionMailer::Base.view_paths = './views'
class Mailer < ActionMailer::Base
def instructions(email_address)
mail(:to => email_address, :subject => 'hello')
end
end
Mailer.instructions('[email protected]').deliver
然後我有兩個文件對我的看法,一個純文本
# ./views/mailer/instructions.text.erb
These are some instructions
還有一對HTML(使用HAML - 我知道有一些潛在的問題與此,這裏的任何建議是讚賞太)
# ./views/mailer/instructions.html.haml
%html
%body
%h1 These are some HTML instructions
但是,如果我檢查我的新創建./tmp/mails/[email protected]
我只有以下,且無正文:
Date: Wed, 07 Sep 2011 18:38:09 +0530
From: [email protected]
To: [email protected]
Message-ID: <[email protected]>
Subject: hello
Mime-Version: 1.0
Content-Type: text/plain;
charset=UTF-8
Content-Transfer-Encoding: 7bit
任何想法這裏發生了什麼?在此先感謝
你已經解決了這個問題嗎? – hade