Mail works for user@host.domain but not for user@domain

I just took the plunge and got my first linode today. Yeah! :D

Got Karmic going with Apache and MySQL. I almost have Postfix working the way I want. Now, the last time I set up a mailserver was 1995. That was sendmail. Suffice to say, I am rusty. :?

Ok, so my domain is and my linode hostname is is [1] I used the excellent Guide to setting up Dovecot and Postfix with MySQL. Whew! After I added a test account ( in the table, I also created a corresponding user on the system. [2] Now mail sent by user 'support' appears to come not from but from Conversely, mail sent to arrives in the 'support' mailbox but mail sent to never shows up. :!:

I see nothing in /var/log/mail.log, which probably makes sense since this seems more likely to be an MTA issue than a POP issue. So I guess I should be looking at the dovecot logs… :?:

Anyway, if anyone just knows what I did "wrong" I would appreciate a pointer. I'm going to dig into the dovecot logs and docs tomorrow.


K Dog

[1] The A records for and seem to have propagated. I have requested an A record for, but I don't think it has propagated yet.

[2] This would be a good thing to add to the Guide.

7 Replies

* Update Start 2010-03-28 *

Ok, try this… Mail sent from to does in fact get delivered! If as root I run 'mutt -f .' in the directory '/home/vmail/' I actually see the email. But if I log in as support (an ordinary user) then mutt gives me only the email which was addressed to Strange…starting to look more like a permissions issue.

  • Update End 2010-03-28 *

More information:

I cleaned out my logs and restarted all services.

Test user is 'support' and I am replacing my true registered domain name with '' for the moment.

mysql> use mail
Database changed
mysql> select * from users;
| email                  | password      |
|   | PleaseNoHack  | 

Now let's send to emails, back-to-back, from an outside account (gmail) to support, first as and then as

Mail sent to '' never shows up in mutt when I am logged in as 'support' – but mail sent to '' does show up in mutt when I am logged in as 'support'.

So let's go to the logs! The first thing I notice is that /var/log/ and /var/log/mail.log are identical. (I checked with diff(1).) Seems redundant?

Mar 28 15:10:09 hostname postfix/smtpd[3992]: connect from[]
Mar 28 15:10:09 hostname postfix/smtpd[3992]: A6A878772:[]
Mar 28 15:10:09 hostname postfix/cleanup[3997]: A6A878772: message-id= <>Mar 28 15:10:09 hostname postfix/qmgr[2428]: A6A878772: from=<>, size=2021, nrcpt=1 (queue active)
Mar 28 15:10:09 hostname postfix/pipe[3998]: A6A878772: to=<>, relay=dovecot, delay=0.11, delays=0.08/0.01/0/0.02, dsn=2.0.0, status=sent (delivered via dovecot service)
Mar 28 15:10:09 hostname postfix/qmgr[2428]: A6A878772: removed
Mar 28 15:10:39 hostname postfix/smtpd[3992]: disconnect from[]
Mar 28 15:11:50 hostname postfix/smtpd[3992]: connect from[]
Mar 28 15:11:50 hostname postfix/smtpd[3992]: 2813A8772:[]
Mar 28 15:11:50 hostname postfix/cleanup[4173]: 2813A8772: message-id= <>Mar 28 15:11:50 hostname postfix/qmgr[2428]: 2813A8772: from=<>, size=2076, nrcpt=1 (queue active)
Mar 28 15:11:50 hostname postfix/local[4174]: 2813A8772: to=<>, relay=local, delay=0.12, delays=0.11/0.01/0/0, dsn=2.0.0, status=sent (delivered to mailbox)
Mar 28 15:11:50 hostname postfix/qmgr[2428]: 2813A8772: removed
Mar 28 15:12:20 hostname postfix/smtpd[3992]: disconnect from[]</></></></></></> 

As you can see, mail sent to is being handled by dovecot, which I would expect based on the MySQL setup. The logs even say it was delivered, but I don't see it in mutt or for that matter in /var/mail/support.

But mail sent to is being handled by a local relay independent of dovecot and is appearing in /var/mail/support and therefore also in mutt.

I do notice the following lines in /etc/postfix/

myhostname =
mydestination =, localhost, localhost.localdomain

where 'hostname' is the host name in /etc/hostname. Could that be the problem? I based that on ~~[" target="blank">]( … with_mysql">](.

I want all my mail handled by postfix+dovecot. Please help if you can.


AHA! Sure enough!

I edited /etc/postfix/ as follows:

mydestination =, localhost, localhost.localdomain


#mydestination =, localhost, localhost.localdomain
mydestination =, localhost, localhost.localdomain

and lo! mail sent to '' works like a champ!

I think maybe the Guide ~~[" target="_blank">]( … .10-karmic">]( should be updated. I'm not saying it's wrong. I'm suggesting it might not be quite what most people expect or need.

I'm fairly new to this as well but here's a guess. I'm sure someone will jump in here and correct me if I'm way off base.

"" is a different user than "support". If you are using virtual users, you should always log in as the virtual user and not as a system (unix user) mailbox name.

For example, my username for SSH login might be "john" and there is a way to mail to the system user "john" but postfix/courier (in my case) don't know anything about "john". But it will know about if I set him up as a virtual user.

I'm not sure of the ramifications of not having the hostname in your mydestination line in I used the postfix/courier/U9.10 tutorial and that one recommends as well. All my users are virtual and is in my virtual domains list (and I suppose subdomains of that as well?); mail to my and both show up in's virtual mailbox.

My guess is that some tutorials are trying to thwart spam that is blindly sent to by setting up their systems to use

Don't know how successful this is though.

Postfix will automatically reject mail for unknown users. From the Postfix readme:

Mail for all other addresses in is rejected with the error message "User unknown".

I believe the answer to your original question lies here: … estination">

Note the very last line of that section:

Caution: in order to avoid mail delivery loops, you must list all hostnames of the machine, including $myhostname, and localhost.$mydomain.

By removing your hostname from the mydestination parameter, you may be introducing mail delivery problems later on (though the postfix documentation, I've found, is rather light on explanations/examples about documented warnings).

This is all very interesting.

The funny thing is… when I had the hostname included, dovecot was delivering only mail sent to the @hostname.domain form, and the @domain for was beng delivered but not by dovecot. Once I replaced hostname.domain with just domain in, both forms were delivered by dovecot. And -- so far -- nothing bad in my logs.

I also found the postfix docs rather light, but no worse than many others.



Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct