Rails 2.3.5郵件實際上並沒有通過我的日誌說它是
這是在我的本地。
我有一個簡單的模型/視圖/控制器
#contact.rb
def deliver_contact
ContactMailer.deliver_contact(self)
end
#contacts_controller
def create
@contact = Contact.new(params[:contact])
respond_to do |wants|
if @contact.save
@contact.deliver_contact
#flash[:notice] = 'Contact was successfully created.'
wants.html { redirect_to('/thanks') }
else
wants.html { render :action => "new" }
end
end
日誌說,它走出去..我可以在我的控制檯做到這一點,它說,它走出去。但是我的收件箱中沒有收到任何內容。我錯過了什麼?
更新
這裏是我的development.rb
:
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => "smtp.gmail.com",
:port => '25',
:domain => "website.com",
:authentication => :login,
:user_name => "[email protected]",
:password => "aged-cheese"
}
的創建日誌
Processing ContactsController#create (for 127.0.0.1 at 2010-11-28 16:12:49) [POST]
Parameters: {"commit"=>"PUNCH IT, CHEWY!", "action"=>"create", "authenticity_token"=>"3zayXGIOWeNLwb+jhx5cIxWgHqEJdv6iwj6I=", "contact"=>{"name"=>"bob marley", "message"=>"asdfasdf", "state_id"=>"Regarding an existing order", "email"=>"[email protected]"}, "controller"=>"contacts"}
Cache miss: Spree::Config ({})
Preference Load (0.3ms) SELECT * FROM "preferences" WHERE ("preferences".owner_id = 1 AND "preferences".owner_type = 'Configuration')
Configuration Load (0.1ms) SELECT * FROM "configurations" WHERE ("configurations"."id" = 1)
CACHE (0.0ms) SELECT * FROM "configurations" WHERE ("configurations"."id" = 1)
Cache write (will save 2.65ms): Spree::Config
Contact Create (0.8ms) INSERT INTO "contacts" ("name", "city", "zip", "created_at", "optin", "updated_at", "state_id", "message", "email") VALUES('bob marley', NULL, NULL, '2010-11-28 21:12:49', NULL, '2010-11-28 21:12:49', 'Regarding an existing order', 'asdfasdf', '[email protected]')
Sent mail to [email protected]
Date: Sun, 28 Nov 2010 16:12:50 -0500
From: [email protected]
To: [email protected]
Subject: HOLY [email protected] you got mail!
Mime-Version: 1.0
Content-Type: text/html; charset=utf-8
<strong>You have just received a dank crispy email.</strong>
<br />
<p>
Here are the details of the message:
</p>
<p>
<strong>Name:</strong>
bob marley
</p>
<p>
<strong>Email:</strong>
[email protected]
</p>
<p>
<strong>Subject:</strong>
Regarding an existing order
</p>
<p>
<strong>Message:</strong>
<br />
asdfasdf
</p>
Redirected to http://localhost:3000/thanks
Completed in 893ms (DB: 5) | 302 Found [http://localhost/contacts]
更新:
嘗試使用gmail tls插件,但沒有奏效。嘗試將settings.rb的設置移至development.rb。
我正在使用spree,但是如果我在環境中放置了某些東西,或者在/ config中放置了development.rb,它將覆蓋Spree的默認值。另外,我可以在Spree的管理員中創建郵件服務器,並且使用正確的規格,它仍然沒有預算。
是否郵件發送該機器上工作的呢? – 2010-11-28 19:58:24
你檢查了你的SPAM文件夾嗎? – bitxwise 2010-11-28 20:04:13
@馬丁,是的,它在我的其他應用程序。 --- @bitxwise,是的,沒有出現。 – Trip 2010-11-28 21:24:50