zakihayaメモ

RubyとRailsのことが中心

RedmineのメールをGmailのSMTPサーバを使って送信する

action_mailer_optional_tls_pluginをインストールする

Redmineのディレクトリへ行き、下記コマンドを実行します。

# cd (Redmineのディレクトリ)
# ruby script/plugin install git://github.com/collectiveidea/action_mailer_optional_tls.git
# gem install tlsmail

${RAILS_ROOT}/config/environment.rbに以下2行を追記。

require "tlsmail"
Net::SMTP.enable_tls(OpenSSL::SSL::VERIFY_NONE)

メール送信設定(config/email.yml)

Redmineが動いている環境(production、development等)に合わせて設定します。

production:
  delivery_method: :smtp
  smtp_settings:
    tls: true
    address: "smtp.gmail.com"
    port: 587
    domain: "smtp.gmail.com"
    authentication: :plain
    user_name: "youraddress@yourdomain.com"
    password: "your password"

確認

adminでログイン
→設定
→メール通知
→テストメールを送信

でメールが送られればOK


Redmine(ruby)でGmailのsmtpを使ってメールを送信する