Cannot send mail from inside docker container Cannot send mail from inside docker container docker docker

Cannot send mail from inside docker container


Looking at the link you've provided and assuming that is exactly what you copied for your Dockerfile you'll need to expose an additional port for your mail client.

If you don't already know, by default, when you create a container, it does not publish any of its ports to the outside world.

In Dockerfiles you can use EXPOSE.In your case you'll needEXPOSE 587 to enable communication for SMTP

Additionally, in the future if you need to expose other ports with different protocols you can use

EXPOSE 587/tcp (tcp is default)

If you want to read up more on EXPOSE I got my information from Docker Docs: https://docs.docker.com/engine/reference/builder/