Use docker mailDev https://hub.docker.com/r/maildev/maildev

docker pull maildev/maildev
docker run -p 1080:1080 -p 1025:1025 maildev/maildev

Then in your application you can configure the following smtp server localhost with smtp port 1025

localhost:1025

All the email you send will not go outside of your computer, but they will go inside the docker container, and you can see all at the following url http://localhost:1080