我花了好幾天試圖讓這項工作=>我想從我的應用程序本地主機,發送電子郵件,而無需使用Gmail或其他郵件服務器,所以我嘗試這樣做:問題與setup_email.rb的ActionMailer配置
在/config/initializers/setup_email.rb
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => "localhost",
:port => 25
}
但我得到 「拒絕連接 - 連接(2)」 錯誤消息類似以下內容:
Connection refused - connect(2)
/home/user1/.rvm/rubies/ruby-1.8.7-p330/lib/ruby/1.8/net/smtp.rb:551:in `initialize'
/home/user1/.rvm/rubies/ruby-1.8.7-p330/lib/ruby/1.8/net/smtp.rb:551:in `open'
/home/user1/.rvm/rubies/ruby-1.8.7-p330/lib/ruby/1.8/net/smtp.rb:551:in `do_start'
/home/user1/.rvm/rubies/ruby-1.8.7-p330/lib/ruby/1.8/timeout.rb:67:in `timeout'
/home/user1/.rvm/rubies/ruby-1.8.7-p330/lib/ruby/1.8/timeout.rb:101:in `timeout'
/home/user1/.rvm/rubies/ruby-1.8.7-p330/lib/ruby/1.8/net/smtp.rb:551:in `do_start'
/home/user1/.rvm/rubies/ruby-1.8.7-p330/lib/ruby/1.8/net/smtp.rb:525:in `start'
/home/user1/.rvm/gems/[email protected]/gems/mail-2.2.15/lib/mail/network/delivery_methods/smtp.rb:127:in `deliver!'
/home/user1/.rvm/gems/[email protected]/gems/mail-2.2.15/lib/mail/message.rb:1967:in `do_delivery'
/home/user1/.rvm/gems/[email protected]/gems/mail-2.2.15/lib/mail/message.rb:228:in `deliver'
/home/user1/.rvm/gems/[email protected]/gems/actionmailer-3.0.3/lib/action_mailer/base.rb:401:in `deliver_mail'
/home/user1/.rvm/gems/[email protected]/gems/activesupport-3.0.3/lib/active_support/messages.rb:52:in `instrument'
/home/user1/.rvm/gems/[email protected]/gems/activesupport-3.0.3/lib/active_support/messages/instrumenter.rb:21:in `instrument'
...
如何配置本地主機爲的ActionMailer?
我搜索互聯網上,似乎我MUST提供用戶名並在配置密碼,並設置認證選項一定的價值,我可以配置的ActionMailer不認證,用戶名和密碼? (因爲我的應用程序沒有用於登錄的電子郵件帳戶) 如何配置使本地主機電子郵件發送功能正常工作?
你運行你的電腦上的郵件服務器? – Augusto 2011-03-16 14:02:34
不,我沒有。 – Mellon 2011-03-16 14:08:23
啊哈,我剛剛發現我有'雷鳥' – Mellon 2011-03-16 14:09:27