I configured my postfix server to relay all received mails to smtp.example.com with relayhost. This server doesn't accept mails from an external source. So only scripts are sending mails.

Is it possible to configure postfix that all mails with a specific mail address in FROM field, like script@domain.net (or also the whole domain: domain.net) are send directly by the server to the corresponding mx server for the TO-address, instead of using the specified relay host?

I found one possibility to specify a specific host if a specific mail address is in the TO field, but not the FROM field: How can I configure Postfix to ignore relayhost for some domains? and http://www.postfix.org/transport.5.html


  • or also the other way around is possible where all mails with @example.com in from field are relayed to a specific host, all others sent directly. – Stefan Profanter Oct 10 '12 at 16:04

You didn't look closely enough.

You'll want sender_dependent_relayhost_maps or one of the things that override it.

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.