Rails梅勒错误“Errno :: ECONNREFUSED(连接被拒绝...)”安装并卸载后缀

问题描述:

我的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”和以前一样。

我不知道如何解决这个问题的想法,所以你可以帮助我,请...

这个问题已经通过写相同的“config.action_mailer.smtp_settings”编码上production.rb为解决环境.RB。

因为在安装postfix之前的默认设置,它似乎没有编码在production.rb上没有问题。