I have a scenario where I'm using a primary SMTP server from cPanel, however I'm running a Dockerized web app on a second server that is having trouble delivering to the main smtp server due to a bug in a Ruby library that's being used.

Would there be any problems caused by setting up Postfix or Exim as a local SMPT server on the Docker app server for the system to use to deliver emails when there's already an existing primary STMP server for the domain? Are there some additional steps that are necessary in order to eliminate any problems in such a configuration?


It is common to have multiple servers in a domain. Normally very few servers, usually designated as an MX, send mail directly to the internet. Only server(s) designated as an MX should be receiving mail from the internet (not likely an issue in your case). Other servers in the network will forward their mail to a relay server, often an MX server, which will route their mail to the internet.

In your case you can install Exim or Postfix in you container, and configure it to use a smarthost. This can be the host if, it accepts mail the network. If not, it should be the relay server for your network.

Their are lighter weight relay servers such as SSMTP which are designed for your situation. This is likely a better fit for your situation.

EDIT: If you need a running sever, then something like Simple Mail Forwarder might be a good fit.

Many libraries will allow you to set the server address for SMTP, which usually defaults to "localhost". They may also allow calling the mail process directly using "sendmail" command line format.

  • Does ssmtp run as a service/daemon so as to facilitate connections that are not used directly through shell based interaction such as mstmp that emulates sendmail? In my use-case I need to send from a Ruby app that requires TCP/IP based access from a Docker container to this service. – ylluminate Oct 20 at 15:48
  • 1
    @ylluminate See t edit. Simple Mail Forwarder seems to be docker ready. – BillThor Oct 23 at 3:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.