6
9

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 5 years have passed since last update.

MailHogでテスト用メールサーバーを立てる

Posted at

image.png

docker-compose.yml
version: "3"
services:
  mail:
    image: mailhog/mailhog:latest
    ports:
      - "8025:8025"
      - "1025:1025"
  • 上記docker-compose.ymlを作成して起動するだけ。
$ vi docker-compose.yml
$ docker-compose up
Recreating mail_mail_1_39afdc4c7660 ... done
Attaching to mail_mail_1_39afdc4c7660
mail_1_39afdc4c7660 | [HTTP] Binding to address: 0.0.0.0:8025
mail_1_39afdc4c7660 | Creating API v1 with WebPath:
mail_1_39afdc4c7660 | Creating API v2 with WebPath:
mail_1_39afdc4c7660 | 2019/01/23 14:58:28 Using in-memory storage
mail_1_39afdc4c7660 | 2019/01/23 14:58:28 [SMTP] Binding to address: 0.0.0.0:1025
mail_1_39afdc4c7660 | 2019/01/23 14:58:28 Serving under http://0.0.0.0:8025/
  • あとはメールを投げればUIから確認可能
$ echo "test" | mail -s "title" -S "smtp=smtp://localhost:1025" -r from@example.com to@example.com

参考

mailhog/MailHog: Web and API based SMTP testing

mailhog/mailhog - Docker Hub

雑に用意するWindowsでのDockerを利用したLaravel開発環境 - Qiita

LaravelでMailHogを導入して快適にメール開発をしよう!【Docker】 | WINDII

ローカルでのテストに使えるメールサーバー、MailHogを試す - CLOVER🍀

mailコマンドでSMTPサーバを指定してメール送信する方法 | ぴぐろぐ

6
9
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
6
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?