4

The situation:

The constellation: We have a managed, dedicated server from a professional provider. We currently have Tobit David.fx server in use within our local network which fetches all E-Mails from the online server via IMAP which are sent to the domain. We would like to replace David.fx with an Ubuntu server which runs Postfix and Dovecot on it.

Our desired system would look like this:

Our users access their mailboxes via an ordinary client (such as Thunderbird) which connects to and fetches the mails for the configured address from our server within our local network.

That local server should do nothing else than fetch all the E-Mail from the IMAP mailbox online and put them in the appropriate mailbox on itself.

Outgoing mail should be sent like that, too, only the other way around. Clients use their mail program which is configured to send via SMTP on the local network server. That server actually does not sent the mails by itself but uses the online server to sent them.

So like if the online server would act like kind of a proxy or tunnel. Setting up forwarding on the online server to our local mail server is not an option.

Am I right to investigate further how to accomplish this with Postfix and Dovecot based on the described situation above? Are they suitable for such scenario? I find a vast amount of resources to read, but because of the same terminology mostly different problems are described in.

PS: I wanted to provide a sketch of it, but because of lacking reputation on ServerFault I could not do yet.

p13n
  • 141
  • 1
  • 3
  • 2
    Could you perhaps describe why you want to set things up like this ? In theory, there is nothing that prevents such a configuration to work (is you add an IMAP sync tool) but depending on your real objectives, it might not be optimal. – Stephane Apr 18 '13 at 14:17
  • 1
    Postfix and Dovecot will do what you want, and are suitable for the task. I might recommend using an IMAP proxy instead if you don't need to actually move the e-mail from the hosted servers. Also you might want to simply fetch the e-mail using something like `getmail`. As for the sketch, post a link without the "http" bit and we'll fix it up. – Chris S Apr 18 '13 at 14:26
  • There are two goals which my superiors would like to retain. **First**: Having the online server with its reliability and reachability because it is part of a datacentre of an external provider. That online server and the online shop hostet on it is reachable via our corporate domain name. **Second**: Our corporate data is not desired to be in "the cloud" or online. We would like to have our central E-Mail server locally. Well, actually, me personally would think another constellation would be more fortunate, but whatever. – p13n Apr 18 '13 at 14:27
  • Additionally, we want to be abled to communicate via E-Mail internally still if our internet connection is lost (we still try to improve in that matter, but it is a bit problematic in the center of the countryside). It makes no sense to us, to be *dependant* on an external server for internal communication. – p13n Apr 18 '13 at 14:39

1 Answers1

1

Here the proposed mail-flow-diagram for your case.

External mail server
   |        ▲
   |        |
  POP3     SMTP
   |        |
   ▼        |
Local mail server

First, you need setup working local mail server with postfix and dovecot. The important parameter for postfix is never list your local domain in relay_domains. You can use virtual_mailbox_domains or mydestination for local domain.

Second, you need to populate/synchronize the user from external mail server to local. So, external mail server has the valid recipient list for receiving email and local mail server has user database for authentication and management.

For outgoing email flow, just setup SMTP submission service with SASL. Then setup relayhost in postfix to your external mail server. You should also setup postfix SMTP client with single username or other method. It would depends on your provider mail server.

For incoming email flow, you should use cron/other daemon method to periodically check INBOX in external mail server, download new messages via POP3 (don't forget to delete it after download) and put it in the right mailbox. Fetchmail will be suitable for this task.

masegaloeh
  • 18,236
  • 10
  • 57
  • 106