1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

DockerでMailcatcherを使ってRuby on Rails開発環境のメールを受信する

Posted at

Mailcatcherの概要は公式サイトで色々記載されています:https://mailcatcher.me

letter_opener も Ruby on Rails 開発環境のメールがテストできるが、個人的には Mailcatcher の方が便利で使いやすいので、よく使います。

docker-compose設定

docker-compose.yml
mailcatcher:
  image: schickling/mailcatcher
  container_name: mailcatcher
  ports:
    - '1080:1080'
    - '1025:1025'

Dockerを起動したら「localhost:1080」で管理画面にアクセスできます。

スクリーンショット 0003-10-30 22.10.33.png

development.rb設定

config/environments/development.rb
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = { address: 'localhost', port: 1025 }
config.action_mailer.raise_delivery_errors = true

Dockerを使わない場合

Mailcatcherのgemインストール

gem install mailcatcher

Mailcatcherを起動

mailcatcher
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?