One of my clients ask me to set-up a multi server, scalable email system.

I can configure multiple servers to send emails. By using PHP Mysql based login script, users will be redirected to each email server with a login cookie. Domain SPF has all those servers so it can send emails without any issue. (All servers are using a single domain name)

But the problem is when it receives emails MX records can only forward emails to a single server. Is there anyway to forward emails to selected servers.

Or is there any other way to achieve this?

I'm going to use Ubuntu/Debian Postfix, Dovecot, roundcube.

Thanks for any answers in advance.

Note - I think postfix's Transport map is the way to go. But I'm not sure how to configure database and local-part based relay routing.

  • 3
    By what process did you determine using Postfix, Dovecot, and roundcube is the best way to meet the requirements? I would have tended towards recommending gmail or exchange online because being a postmaster sucks. Oct 22 '14 at 2:27
  • I know there are plenty of other tools out there such as gmail and exchange, but my client is a control freak I would say. He needs everything under his thumb! After researching I realised above systems has decent online community comparing to the other open-source resources. I also need to give it a try rather than convincing him to use something else.
    – M_R_K
    Oct 22 '14 at 2:36
  • 1
    I don't have a proven answer but I'd investigate using dovecot's dsync replication with haproxy in front of postfix (using the proxy protocol so you get the client IP for spam filtering) and also haproxy in front of roundcube. All the mail goes to every server so I'm not sure it "scales." Oct 22 '14 at 2:52
  • You didn't even give an idea about the number of users that need to be served by this solution.That doesn't give me much confidence in the project.
    – ewwhite
    Oct 22 '14 at 6:46
  • It may go up to 10000 users or more than that. But number doesn't matter because it has to be scalable.
    – M_R_K
    Oct 23 '14 at 6:45

With a distributed storage (like http://ceph.com/) you can just deliver the emails on backup MXes too. In this situation all mail servers would have the same configuration and just share common storage for maildirs.

It would be very handy to have a shared user db too, like Kondybas mentioned, DBMS would solve this problem.

  • Multiple dovecots are not working well with shared storage. Therefore it is preferrable to split storage into segments served by its own dovecot each.
    – Kondybas
    Oct 22 '14 at 6:44
  • 1
    It works, but needs some care: wiki2.dovecot.org/MailLocation/SharedDisk
    – neutrinus
    Oct 22 '14 at 7:14

Because you store a link between login and exact server user bind to, and probably store it in the DBMS like mysql, you can check that link on the main MX at receiption time and route the message to the corresponding server. If logins are used as localpart, indeed.

UPD. If you can de-aliase localpart at the frontend MX, then localpart is not limited to login.

  • What you are saying is make sense. Indeed I can put all login and and server information in a MySQL database. But how can I check main MX at the reception with the database? Does dovecot has any built in mechanism for that?
    – M_R_K
    Oct 22 '14 at 11:41
  • MX is a MTA like postfix or exim. exim can easily talk to DB and make a search, using results as condition for message routing.
    – Kondybas
    Oct 22 '14 at 17:44
  • Yes I researched about it and found out about postfix transport table. But I have to find a way to use transport table just with the local part
    – M_R_K
    Oct 23 '14 at 6:43
  • I'm not familiar with postfix but exim is flexible enough to do anything I want.
    – Kondybas
    Oct 23 '14 at 7:14

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.