# Running two Mail Servers (sendmail and exim) on the same server, one in a jail



## jjthomas (Aug 9, 2020)

I am running FreeBSD 12.1.  It has the default sendmail server running.

I want to install exim in a jail.  I want to have exim connect to my mail server in another state, Texas.  All it will do is connect and download the mail. A local mirror if you will.  Exim will not sendmail, or act as a mail server for my local network.

It has been a while since I worked with FreeBSD jails.  If I set up exim in a jail will it interfere with sendmail.  I want to keep the two separate.

Is this doable? Will the two servers see each other, if one is in a jail?  Would I be better off putting sendmail in a jail, as well?”

Thank you.

-JJ


----------



## Jose (Aug 9, 2020)

Yes, there are several ways to accomplish what you propose. Have you looked at Fetchmail?


----------



## neel (Aug 9, 2020)

You can run a seperate MTA in a jail, since a jail is a separate logical system with a separate userland. For instance, you can run Exim or Postfix in a jail, while the base system runs Sendmail.

If you want to access your email remotely, however, you need a Mail Delivery Agent (MDA) like Dovecot on your primary email server. This is what I do for personal email: Postfix as a MTA, Dovecot as a MUA MDA. Then, I can access my emails via IMAP or Roundcube.

You don't need to run Exim unless you want to send to or receive from other email servers. As a client, Exim is unnecessary.


----------



## drhowarddrfine (Aug 10, 2020)

neel said:


> you need a Mail Delivery Agent (MDA) like Dovecot
> Dovecot as a MUA


You're going to need to explain yourself there.


----------



## olli@ (Aug 10, 2020)

First, what protocol do you want to use for “downloading” mail? Do you mean something like POP or IMAP? In that case you don’t need to run a full mail server like exim. Just running fetchmail, for example, should be sufficient.

However, if you still want to run exim in the jail (for whatever reason), just make sure that the exim server is not listening on the standard SMTP ports (typically 25 and 587), because these should be used by the sendmail server on the host only. Then there cannot be a conflict. You can use the sockstat(1) command to find out on which ports a process is listening.


----------



## neel (Aug 10, 2020)

drhowarddrfine said:


> You're going to need to explain yourself there.


"Dovecot as a MUA" was a typo. I meant MDA


----------



## Mjölnir (Aug 10, 2020)

jjthomas said:


> I want to install exim in a jail.  I want to have exim connect to my mail server in another state, Texas.


You need an offical approval of the _Mail of Texas Authority (MTA)_ 


> All it will do is connect and download the mail. A local mirror if you will.


That's not a matter of the OS, but how to configure the two MTAs of the mirror, isn't it? 


> Exim will not sendmail, or act as a mail server for my local network.


If you only want to grab the mail of a few accounts, a MTA like _exim_ is not needed.  mail/fetchmail or similar does that, like said above.


----------



## Mjölnir (Aug 10, 2020)

jjthomas said:


> I want to install exim in a jail.  I want to have exim connect to my mail server in another state, Texas.


You need an offical approval of the _Mail of Texas Authority (MTA)_ 


> All it will do is connect and download the mail. A local mirror if you will.


That's not a matter of the OS, but how to configure the two MTAs of the mirror, isn't it? 


> Exim will not sendmail, or act as a mail server for my local network.


If you only want to grab the mail of a few accounts, a MTA like _exim_ is not needed.  mail/fetchmail or similar does that, like said above.


----------

