postfix relay emails dynamically – Managing your servers can streamline the performance of your team by allowing them to complete complex tasks faster. Plus, it can enable them to detect problems early on before they get out of hand and compromise your business. As a result, the risk of experiencing operational setbacks is drastically lower.
But the only way to make the most of your server management is to perform it correctly. And to help you do so, this article will share nine tips on improving your server management and fix some problem about linux, email, postfix, , .
Is it possible to relay incoming emails dynamically with postfix’s
relayhost = proxy:mysql:/etc/postfix/email2server.cf
and I used mysql database to query each email with relay host. But did not work.
if I defined
relayhost = myhost2.tld statically it works.
Am I doing this completely wrong? What is the correct way to achieve this?
Thanks for any answers in advance.
You can not use a SQL lookup as relayhost parameter. See the postconf manpage man 5 postconf:
... relayhost (default: empty) The next-hop destination of non-local mail ...
To relay depeding on the recipient email address you have to define the transport_maps parameter in your postfix configuration. In your case this would look like this:
transport_maps = proxy:mysql:/etc/postfix/email2server.cf