###エラー発生の概要
RailsアプリのMailer(Gmailを使用)にて、メールの送信を実行するタイミングでエラーメッセージが発生しており困っています。
Railsのコードは特にいじっておらず、さくらVPSでメールサーバーを構築するために「postfix」をインストール・アンインストールした後にエラーが発生し始めました。
###発生しているエラーメッセージ
log/production.log
NoticeMailer#newtask_email: processed outbound mail in 2.5ms I, [2016-08-19T10:55:13.429666 #3782] INFO -- : Sent mail to email@example.com (4.2ms) D, [2016-08-19T10:55:13.429750 #3782] DEBUG -- : Date: Fri, 19 Aug 2016 10:55:13 +0900 From: info@domain.com To: email@example.com 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'
###関連するソースコード
config/environments/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: 'xxxxx@gmail.com', password: 'xxxxx' }
config/environments/production.rb (コメントアウトは省略)
Rails.application.configure do config.cache_classes = true config.eager_load = true config.consider_all_requests_local = false config.action_controller.perform_caching = true config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present? config.assets.js_compressor = :uglifier config.assets.compile = false config.assets.digest = true config.log_level = :debug config.logger = Logger.new("log/production.log", 5, 10 * 1024 * 1024) config.i18n.fallbacks = true config.active_support.deprecation = :notify config.log_formatter = ::Logger::Formatter.new config.active_record.dump_schema_after_migration = false end
###問題の推測と疑問点
前述の通り、Railsのコード自体は一切いじっておらず、"postfix"をインストール・アンインストールする前は、本番環境で上手く稼働していました。したがって、"postfix"のインストールでサーバーの設定が少し変わったのではないかと推測しています。Gmailを利用しているので、ポート番号を587に指定していますが、エラーメッセージでポート番号25となっているので、この点を怪しく感じていますが、具体的な解決手段が分かりません。
詳しい方のお力添えいただけると大変幸いに思います…どうかお助け下さい。。
###実施した postfix インストール・アンインストール手順
インストールは下記サイトに従いました:
http://tipszone.jp/20120521_mail_server/
アンインストールは以下のコマンドを実行しました:
"yum erase postfix"
"yum remove dovecot"
"rm -rf /etc/postfix"
"rm -rf /etc/dovecot"
アンインストール後、サーバーを再起動しました:
"reboot"
"service httpd restart".
"/etc/sysconfig/iptables"も元の状態に戻しています。
###補足情報(言語/FW/ツール等のバージョンなど)
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]
Rails 4.2.6
Server version: Apache/2.2.15 (Unix)
CentOS release 6.7 (Final)
回答1件
あなたの回答
tips
プレビュー