我的Ruby on Rails應用程序突然出現如下錯誤,當它試圖發送郵件與郵件程序使用Gmail。Rails梅勒錯誤「Errno :: ECONNREFUSED(連接被拒絕...)」安裝並卸載後綴
在我安裝&卸載服務器(Apache/CentOS)上的「postfix」後開始出現這個問題,因爲安裝對我來說太困難了。在此之前,梅勒正常工作。
日誌/ production.log
NoticeMailer#newtask_email: processed outbound mail in 2.5ms
I, [2016-08-19T10:55:13.429666 #3782] INFO -- :
Sent mail to [email protected] (4.2ms)
D, [2016-08-19T10:55:13.429750 #3782] DEBUG -- : Date: Fri, 19 Aug 2016 10:55:13 +0900
From: [email protected]
To: [email protected]
Message-ID: <defaultdomain.mail>
Subject: test
Mime-Version: 1.0
Content-Type: text/plain;
charset=UTF-8
Content-Transfer-Encoding: 7bit
(Message)
test
I, [2016-08-19T10:55:13.430023 #3782] INFO -- : Completed 500 Internal Server Error in 17ms (ActiveRecord: 2.0ms)
F, [2016-08-19T10:55:13.431110 #3782] FATAL -- :
Errno::ECONNREFUSED (Connection refused - connect(2) for "localhost" port 25):
app/controllers/tasks_controller.rb:41:in `create'
相關編碼如下所示:
配置/環境/ development.rb
config.action_mailer.default_url_options = { host: 'localhost:3000' }
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: 'smtp.gmail.com',
port: 587,
domain: 'gmail.com',
authentication: :plain,
user_name: '[email protected]',
password: 'xxxxx'
}
的上應該是編碼精細。所以,我猜想由於安裝了postfix,一些服務器設置已經發生了變化。
我下面寫上網站的程序安裝後綴: http://tipszone.jp/20120521_mail_server/
而且,我通過「蔭擦除後綴」卸載它,「百勝刪除dovecot的」,「室射頻/等/後綴」和「 rm -rf/etc/dovecot「。之後,我做了「重啓」和「服務httpd重啓」。
「/ etc/sysconfig/iptables」和以前一樣。
我不知道如何解決這個問題的想法,所以你可以幫助我,請...