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
雑に用意するWindowsでのDockerを利用したLaravel開発環境 - Qiita
LaravelでMailHogを導入して快適にメール開発をしよう!【Docker】 | WINDII