尋常でないもふもふ

a software engineer blog

Redmine2.2のGmail(TLS)によるメール通知

1.1 系から 2.2 系への移行をしたところ、メール通知が届かなくなり困った。

action_mailer_optional_tls プラグイン

以前の環境では TLSをサポートしていない Ruby-1.8 だったので Redmine プラグインが必須だったが、今回は Ruby-1.9 にしたので不要。

configuration.yml

メール通知のためのconfiguration.ymlの設定

Redmine1.1 までは config/email.yml を利用していたが、Redmine1.2 以降は config/configuration.yml に変更となっている。

config/configuration.yml.example をコピペして利用しろと書いてあり、その通りコメントアウトされている Gmail(TLS)用設定を書き変えて有効にした。

production:
  email_delivery:
    delivery_method: :smtp
    smtp_settings:
      enable_starttls_auto: true
      address: smtp.gmail.com
      port: 587
      domain: smtp.gmail.com
      authentication: :plain
      user_name: "your-gmail-address@gmail.com"
      password: your-gmail-password-0000

だけどメールはこない。
ググるとダブルクオーテーションの使い方に問題があるでてきたが、それも違った。根本的な原因は最下部付近に production: が存在するから。

# specific configuration options for production environment
# that overrides the default ones
production: # <-----------------------------------------こいつ最高にアホ

# specific configuration options for development environment
# that overrides the default ones
development:

これにより production: が重複して記述され、後方の production: のみ有効となる。つまり設定が空白となる。
この production: をコメントアウトすれば解決。