Ubuntu – Postfix appears to ignore domain’s MX records

emailmx-recordpostfixUbuntu

On my dedicated server, I have Postfix installed for sending email through the websites. One of my clients hosts their email with a third party so we have MX records set up on the domain.

However, when sending any Postfix emails from the server, they do not get the emails. I think since the domain is pointing at the server itself, it tries to send mail to itself, but there is nothing on the server to handle the email for that domain. (There are mail accounts for other domain which are working fine.)

How do I get Postfix to use the domain's MX records to send email? Server is Ubuntu 8.10 with standard LAMP stack. I have Webmin installed, and a control panel called "Matrix" provided by the host.

EDIT: if I try to send email from my own address, I get an error email from the Mail Delivery System, with this error:

<client@mydomain.co.uk>: user unknown. Command output: Invalid user specified.

Final-Recipient: rfc822; client@mydomain.co.uk
Action: failed
Status: 5.1.1
Diagnostic-Code: x-unix; Invalid user specified.

Here are the log entries made:

Jan  6 18:06:52 localhost postfix/pickup[29006]: 0329D3F69: uid=33 from=<me@example.com>
Jan  6 18:06:52 localhost postfix/cleanup[30495]: 0329D3F69: message-id=<fa94de81423027557f28dc0600f1bf6a@www.mydomain.co.uk>
Jan  6 18:06:52 localhost postfix/qmgr[22461]: 0329D3F69: from=<me@example.com>, size=611, nrcpt=2 (queue active)
Jan  6 18:06:52 localhost postfix/pipe[30497]: 0329D3F69: to=<client@mydomain.co.uk>, relay=maildrop, delay=0.15, delays=0.1/0/0/0.04, dsn=5.1.1, status=bounced (user unknown. Command output: Invalid user specified. )
Jan  6 18:06:52 localhost postfix/smtp[30498]: 0329D3F69: to=<me-copy@example.com>, relay=gmail-smtp-in.l.google.com[209.85.227.27]:25, delay=0.61, delays=0.1/0.01/0.06/0.45, dsn=2.0.0, status=sent (250 2.0.0 OK 1294337212 o18si30528441wbo.103)
Jan  6 18:06:52 localhost postfix/cleanup[30495]: 868723F75: message-id=<20110106180652.868723F75@localhost.example.co.uk>
Jan  6 18:06:52 localhost postfix/bounce[30500]: 0329D3F69: sender non-delivery notification: 868723F75
Jan  6 18:06:52 localhost postfix/qmgr[22461]: 868723F75: from=<>, size=2553, nrcpt=1 (queue active)
Jan  6 18:06:52 localhost postfix/qmgr[22461]: 0329D3F69: removed
Jan  6 18:06:52 localhost postfix/pipe[30497]: 868723F75: to=<me@example.com>, relay=maildrop, delay=0.06, delays=0.01/0/0/0.05, dsn=2.0.0, status=sent (delivered via maildrop service)
Jan  6 18:06:52 localhost postfix/qmgr[22461]: 868723F75: removed

Best Answer

So, I'm bored at work and thought I'd mention the following. I've never used this site before, so, forgive me.

To one of the answers, you commented afterwards to say:

"OK, I have virtual_mailbox_domains = $transport_maps and transport_maps = hash:/etc/postfix/transport. Inside that file is a line that says condorproperties.co.uk maildrop: - should I delete that line? – DisgruntledGoat yesterday"

then followed it with:

"@Devdas: I've tried deleting that line and restarting Postfix, it doesn't fix the problem, do I need to change "maildrop" to something else? – DisgruntledGoat yesterday"

The answer to your first question is, "yes." That line in /etc/postfix/transport was forcing local maildelivery (via maildrop) for email destined for condorproperties.co.uk. Removing it is most appropriate. The problem is simply restarting postfix is insufficient to apply the change.

The problem is, the map as configured in the configuration file, is a hash:/etc/postfix/transport. The file, /etc/postfix/transport is the human-readable version of the file and should have a corresponding /etc/postfix/transport.db - the compiled hashmap - file as well. You use the command postmap to compile the human-readable version into the hashed version. Postfix does check modification times and should be complaining loudly in your logfiles that /etc/postfix/transport.db is out of date. All you need to do is run postmap /etc/postfix/transport so that the change you made before, (removing the line with the condorproperties.co.uk) to take effect. In fact, I don't believe you even have to do a postfix reload for the change to go live once you've issued the postmap command, but it wouldn't hurt.

Long story short, run postmap /etc/postfix/transport then postfix reload.

Cheers.

Btw, the huge clue in your logfiles was this line: Jan 6 18:06:52 localhost postfix/pipe[30497]: 0329D3F69: to=, relay=maildrop, delay=0.15, delays=0.1/0/0/0.04, dsn=5.1.1, status=bounced (user unknown. Command output: Invalid user specified. )

notice, halfway through, where it says relay=maildrop?