2025/05/22

smtp4dev

## smtp4dev 
[https://github.com/rnwood/smtp4dev](https://github.com/rnwood/smtp4dev)
> A dummy SMTP server for Windows, Linux, Mac OS-X (and maybe elsewhere where .NET Core is available).

## インストール
[https://github.com/rnwood/smtp4dev/wiki/Installation](https://github.com/rnwood/smtp4dev/wiki/Installation)

## 起動方法(Windowsの場合)
ZIPを解凍後、Rnwood.Smtp4dev.exeを実行する。
デフォルトの5000番ポートをregistryなどで使用している場合は、別のポートを指定する。
```
C:\test\smtp4dev>Rnwood.Smtp4dev.exe --urls=http://localhost:5050
```

起動例(25番ポートでなく1025番ポートでListenしているので注意)
```
DataDir: C:\Users\CAST-A152\AppData\Roaming\smtp4dev
Using Sqlite database at C:\Users\CAST-A152\AppData\Roaming\smtp4dev\database.db
TLS mode: None
SMTP Server is listening on port 1025.
Keeping last 100 messages and 100 sessions.
IMAP Server is listening on port 143
Hosting environment: Production
Content root path: C:\test\smtp4dev
Now listening on: http://localhost:5050
Application started. Press Ctrl+C to shut down.
```

## 送信
localhost:1025 宛にメールを送信する。

Docker上のWebAPサーバからメール送信する場合、localhost はコンテナ自身を参照してしまう。
その場合は、メールサーバーに「host.docker.internal」を指定する。

> [コンテナからホスト上のサービスに対して接続したい](https://docs.docker.jp/desktop/networking.html#desktop-networking-i-want-to-connect-from-a-container-to-a-service-on-the-host)


## 受信
管理画面でメールを確認
http://localhost:5050/

0 件のコメント:

コメントを投稿

人気の投稿