redmineにメール(gmail)設定

Post date: 2014/06/26 7:39:17

redmineのメールにgmailを設定した際、ruby 1.8.7だと、"メール送信中にエラーが発生しました (wrong argument (NilClass)! (Expected kind of OpenSSL::SSL::SSLContext))"というエラーが発生する。

Redmine 2.5 + Ruby 1.8 環境下で TLS でメールが送れなくなった場合の対処 によれば、Gemfileに

gem 'mail', '= 2.5.4', :git => 'https://github.com/sofatutor/mail', :branch => '2.5.4-with-fix-548' # see https://github.com/mikel/mail/issues/548

をすれば良いとのこと。確かに、bundle exec rails sで起動し、http://localhost:3000 ではメールを送れた。しかし、passengerからだと上記gemが悪さするのか以下のエラーとなる:

*** Exception PhusionPassenger::UnknownError in PhusionPassenger::Rack::ApplicationSpawner (https://github.com/sofatutor/mail (at 2.5.4-with-fix-548) is not yet checked out. Run `bundle install` first. (Bundler::GitError))

ちなみに、configuration.ymlは、以下の通り。

production:

email_delivery:

delivery_method: :smtp

smtp_settings:

enable_starttls_auto: true

address: "smtp.gmail.com"

port: 587

domain: "smtp.gmail.com" # 'your.domain.com' for GoogleApps

authentication: :plain

user_name: "seijiro.moriyama@gmail.com"

password: "”

記憶が正しければ、tls :true を入れると、An error occurred while sending mail (SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: unknown protocol) というエラーが出た。

注意: configuration.yml の最後に、production: という行がコメントアウトされてなければ、以下のエラーが出る:

getaddrinfo: Name or service not known