Mail setup with hostname using external server

I am a bit stuck, I am not familiar with much server internals in details. In short, I have a Virtualmin machine with hostname set to my main web address.

This address however uses an external mail service. So mails from the server was not reaching my inbox. Therefore I changed the general options of postfix to:

What domains to receive mail for "localhost.$mydomain, localhost, localhost.localdomain"

Which means the server will now use the mx server defined by the DNS.

However now I have a second domain and I try to send a test message to that domain’s new mailbox on Virtualmin.

I am then informed this cannot be done:

<user@hostname.com> (expanded from <user@seconddomain.com>): host
mx.externalserver.com[99.99.999.999] said: 550 5.7.1 recipient
<user@hostname.com> unknown #292 (l18Exp094353299400) (in reply to
RCPT TO command)

So my question is… why is postfix forwarding user@seconddomain.com to user@hostname.com in order to deliver the mail? What settings can I amend to fix this problem?

Any help would be much appreciated.

This server is on the Virtualmin GPL on EC2.<br><br>Post edited by: lightwisters, at: 2009/02/09 11:17

Answered my own question…

Don’t use main domain as hostname. Use server.domain.com. This will avoid this issue.

You also cannot remove $hostname.<br><br>Post edited by: lightwisters, at: 2009/02/09 12:53