2012-09-26 15 views
0

它已被問及可能數百萬次,但我的情況是不同的,我嘗試了每個可以想象的配置選項,並嘗試在生產模式下使用。電子郵件已呈現,但不會出現在任何地方。我甚至買了15美元的MockSMPT應用程序來查看電子郵件,但似乎沒有任何結果。Rails 3動作Malier渲染模板並不發送電子郵件

這裏是CONFIGS爲MockSMTP:

config.action_mailer.delivery_method = :smtp 
ActionMailer::Base.smtp_settings = { 
    :address => "localhost", 
    :port => 1025, 
    :domain => "whatever.com" 
} 
config.action_mailer.raise_delivery_errors = true 
config.action_mailer.perform_deliveries = true 

我都想盡delivery_method:test:file,我撕我的頭髮脫落,沒有什麼幫助:

Rendered contact_mailer/contact_email.html.erb (2.1ms) 

,這是它。

代碼發送很簡單:

def contact_email(contact, house=nil) 
    @house=house if house 
    @contact=contact 
    mail(to: contact.email, subject: "#{contact.name} new inquiry") 
end 

Rails 3.2.8

contact_controller.rb

def create 
    @contact = Contact.new(params[:contact]) 
    if @contact.valid? 
    @house=House.find_by_id(params[:house_id]) 
    ContactMailer::contact_email @contact, @house 
    end 
end 
+0

您可以分享您發送電子郵件的代碼以及您正在使用的導軌版本嗎? –

+0

添加了代碼。 – firedev

+0

您實際調用郵件程序操作的代碼可能在控制器的某個位置? –

回答