I'm in the process of configuring an email platform and I would like to clear some doubts that I have.
When building this system I have 2 options:
- Have
PHP
doing the connections to mySMTP
external server (it's a delivery only server). This is how my network is configured at the moment and I feel it's very heavy on the server. - Have
PHP
connecting to my localMTA
and having the localMTA
(Postfix
) connecting throughSMTP
to my external delivery server
I think the option 2 is the preferable one for a couple of reasons:
- Dispatch from the email platform is faster
PHP
processes will finish faster- Delivery itself will be on Postfix (local MTA) responsibility thus creating a new layer on the delivery data flow providing a lot more abstraction on the
PHP
platform - Delivery rules can be defined specifically on
Postfix
So, question 1 is if this is the preferable solution or if I should keep option 1?
Bellow is a small representation of what I'm referring in point 2:
+------------+
| |
+---> smtp external backend a ----->| |
| | |
platform -------> local MTA lb ---> smtp external backend b ----->| Delivery |
| | |
+---> smtp external backend c ----->| |
| |
+------------+
Question 2:
If this is the preferable situation how can I create a load balance Postfix
solution?
I need to be able to easily add and remove SMTP
servers.
First. Two questions in one is bad!
1) As you didn't find negative arguments for option 2 you should choose option 2.
2) You need no Postfix load balancer. Postfix on a recent machine is able to deliver 100 mails per second. With good hard-drives and a bit of queue management even more. I don't know why to extend that? And if you really really really need it then you should have an in-house DNS server with low TTL and use multiple A records for your local MTA (1b). The DNS is then doing round-robin load balancing for you.