Sending mail from inside docker container

I am completely new do Docker, and a total n00b to linux, so apologies if this sounds silly.

I have gotten a docker system up and running on Digital Ocean, and its working nicely.

I am using a pre-built Mirth Connect docker and this runs beautifully and I can do all sorts of cool things. One of the things I want my Mirth to do for me is to send an email (SMTP sender) from inside the container but it seems that a Docker Container cannot send emails (I get an error about connecting to my mail server). I have tried mapping port 25 to 25 when running that did nothing.

docker run -d --name mirth1 -p 8080:8080  -p 8443:8443 -p 25:25 -p 8585:8585 brandonstevens/mirth-connect

The linux server can telnet into my mail server on port 25, so I know its not a firewall / Digital Ocean issue. Its also not a Mirth issue because Ive dont this a billion times before. Its something inside the container

So I guess there is more to this than I thought. Googling reveals a lot of links about adding sendmail to my container, but thats for php systems?

You only need 25 outbound and you need to have a default mail software for the container. You do not need the port 25 mapped for outbound connections but you do need a default mail software installed in the container like postfix or sendmail .Just add it after you started the container, test if it works, then add it to the docker file.

Please remember that containers are minimal so do not expect any extra functionality in them.

“I get an error about connecting to my mail server” - what error?

sending the email to the following server failed: mail.xxxxx.co.za:25