The server hosts the web site for domain1.com but email is handled by another server (not controlled by me and the MX record for domain1.com reflects this.
However when I send an email to info@domain2.com, it is immediately returned to sender with the error:
<info@domain1.com> (expanded from <info@domain2.com>): User unknown in virtual alias table
I am assuming this is because postfix is looking for the user info@domain1.com on the local machine, whereas in fact it needs to forward to box detailed in the MX record for the domain.
How can I force it to look external for the email service for domain1.com?
Okay I see… this might be either a bug or unfortunate behavior of Virtualmin… Since you’re trying to forward to a domain that’s managed by your system, Virtualmin might expect to also be responsible for its email in that case. I think though that what you’re trying to do should be possible, i.e. define an email forwarding target that’s a locally known domain that doesn’t have local email.
Maybe Eric or Jamie could barge in here and give some insight?
Just to report back, I got around this problem by (1) changing the setting for “What domains to receive mail for” to remove the hostname from that field, and (2) editing the file at /etc/postfix/virtual to remove any references to the domain I don’t want delivered locally.
Step (1) I did through webmin, but step (2) I did by editing the file directly. I guess I am expecting that when I change other settings in postfix (if I ever do) that the problem may return, since the /etc/postfix/virtual might be recreated on applying any other settings?
I guess the problem I have is that the parent server has sub-servers which share the same web site, but the sub-servers’ mail is forwarded to an address at the parent server’s domain which is hosted elsewhere, and that seems to be an illegal configuration from Virtualmin’s point of view.