I've found the solution and it is a dumb one.

So there is no reason for Joplin Server to outside if the email server is in the same server or docker container.
So I changed the /etc/hosts files in order to have the IP pointing to the hostname of the mail server and is working.

Long story short.

If you have you mail server running in the same network as the Joplin Server go to:

$ sudo /etc/hosts

and add the IP address and the mail server, although in my case is the same Joplin or my firewall doesn't seem to like it, example:

192.168.1.2 mail.domain.example

I've tested with the localhost and 127.0.0.1 and it didn't work.

In hopes this helps.