2016-08-19 16 views
1

Mailerと電子メールを送信しようとするとRuby on Railsのアプリケーションが突然エラーになりましたGmailを使用してRails Mailerエラー "Errno :: ECONNREFUSED(接続が拒否されました...)"インストール後とアンインストール後Postfix

この問題は、インストールがあまりにも難しかったので、&がアンインストールされた "postfix"をサーバー(Apache/CentOS)にインストールした後に開始されました。その前に、メーラーは正常に機能していました。

ログ/ 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のインストールのために変更されたと思います。

私はwebisteに書かれた手順に従って接尾辞をインストール: http://tipszone.jp/20120521_mail_server/

そして、私は "RM -rfは/ etc/postfixの"、 "YUMのdovecotを削除"、 "yumを消去後置" で、それをアンインストールし、 " rm -rf/etc/dovecot "と入力します。その後、私は "再起動"と "サービスhttpdの再起動"を行いました。

"/ etc/sysconfig/iptables"も以前と同じです。

答えて

0

この問題は、環境としてproduction.rbにコーディング同じ「config.action_mailer.smtp_settings」を書き込むことによって解決されています...私はこの問題を解決する方法については考えているので、あなたは私を助けてください可能性があり.rb。

postfixをインストールする前に、デフォルト設定のためにproduction.rbのコーディングがなければうまくいたようでした。

関連する問題