1

I have a postfix mail server running on a Debian machine.

This server handles all incoming mail. However, I want all mail sent to a certain subdomain to be handled by another mail server running on another port on the computer.

In other words, all mail going to *@subdomain.domain.tld should go to address and port XX.XX.XX.XX:YYYY

At the moment I handle aliases in /etc/postfix/virtual but I don't see how to enter this rule there.

I should also mention, that postfix is (probably) not equipped to receive any mail coming to the subdomain at the moment. Therefore it would be great if you could explain how to get there from the start...

How can this be achieved?

1

If I understand your question correctly, you have to (1) enable relay for this domain and (2) set the destination server in transport map.

Backup the postfix config file before any changes (not required, but recommended).

  1. In order to allow relay, you need to set relay_domains = subdomain.domain.tld in your postfix config (most likely /etc/postfix/main.cf).

  2. Then, you need to set destination server in the config file for this domain using transport_maps = hash:/etc/postfix/transport (or any other file postfix has access to); create this file with content subdomain.domain.tld smtp:XX.XX.XX.XX:YYYY, (assign permissions if needed) and build the database using shell command postmap /etc/postfix/transport.

Don't forget to restart postfix after your changes.

| improve this answer | |
  • works like a charm! You, are my personal hero of the day! – speendo Jan 14 '18 at 1:40
  • 1
    @speendo My pleasure to help. :-) – Kotoniu Jan 14 '18 at 8:10

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.