Mail works for user@host.domain but not for user@domain
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 nebulocity.net and my linode hostname is is zathras.nebulocity.net. [1] I used the excellent Guide to setting up Dovecot and Postfix with MySQL. Whew! After I added a test account (
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.
Thanks,
K Dog
[1] The A records for mail.nebulocity.net and
[2] This would be a good thing to add to the Guide.
7 Replies
Ok, try this… Mail sent from
- Update End 2010-03-28 *
I cleaned out my logs and restarted all services.
Test user is 'support' and I am replacing my true registered domain name with 'mydomain.net' for the moment.
mysql> use mail
Database changed
mysql> select * from users;
+------------------------+---------------+
| email | password |
+------------------------+---------------+
| support@mydomain.net | PleaseNoHack |
+------------------------+---------------+
Now let's send to emails, back-to-back, from an outside account (gmail) to support, first as
Mail sent to '
So let's go to the logs! The first thing I notice is that /var/log/mail.info 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 mail-pw0-f52.google.com[209.85.160.52]
Mar 28 15:10:09 hostname postfix/smtpd[3992]: A6A878772: client=mail-pw0-f52.google.com[209.85.160.52]
Mar 28 15:10:09 hostname postfix/cleanup[3997]: A6A878772: message-id= <ff7aef871003281510k4b0649bel6b0114f5ebfc400f@mail.gmail.com>Mar 28 15:10:09 hostname postfix/qmgr[2428]: A6A878772: from=<kblinode@gmail.com>, size=2021, nrcpt=1 (queue active)
Mar 28 15:10:09 hostname postfix/pipe[3998]: A6A878772: to=<support@mydomain.net>, 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 mail-pw0-f52.google.com[209.85.160.52]
Mar 28 15:11:50 hostname postfix/smtpd[3992]: connect from mail-pw0-f49.google.com[209.85.160.49]
Mar 28 15:11:50 hostname postfix/smtpd[3992]: 2813A8772: client=mail-pw0-f49.google.com[209.85.160.49]
Mar 28 15:11:50 hostname postfix/cleanup[4173]: 2813A8772: message-id= <ff7aef871003281511j142d9337v29442c54de966708@mail.gmail.com>Mar 28 15:11:50 hostname postfix/qmgr[2428]: 2813A8772: from=<kblinode@gmail.com>, size=2076, nrcpt=1 (queue active)
Mar 28 15:11:50 hostname postfix/local[4174]: 2813A8772: to=<support@hostname.mydomain.net>, 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 mail-pw0-f49.google.com[209.85.160.49]</support@hostname.mydomain.net></kblinode@gmail.com></ff7aef871003281511j142d9337v29442c54de966708@mail.gmail.com></support@mydomain.net></kblinode@gmail.com></ff7aef871003281510k4b0649bel6b0114f5ebfc400f@mail.gmail.com>
As you can see, mail sent to
But mail sent to
I do notice the following lines in /etc/postfix/main.cf:
...
myhostname = hostname.mydomain.net
...
mydestination = hostname.mydomain.net, localhost, localhost.localdomain
...
where 'hostname' is the host name in /etc/hostname. Could that be the problem? I based that on
I want all my mail handled by postfix+dovecot. Please help if you can.
Thanks.
I edited /etc/postfix/main.cf as follows:
mydestination = hostname.mydomain.net, localhost, localhost.localdomain
becomes
#mydestination = hostname.mydomain.net, localhost, localhost.localdomain
mydestination = mydomain.net, localhost, localhost.localdomain
and lo! mail sent to '
I think maybe the Guide
"
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
I'm not sure of the ramifications of not having the hostname in your mydestination line in main.cf. I used the postfix/courier/U9.10 tutorial and that one recommends hostname.mydomain.com as well. All my users are virtual and mydomain.com is in my virtual domains list (and I suppose subdomains of that as well?); mail to my
Don't know how successful this is though.
Mail for all other addresses in example.com is rejected with the error message "User unknown".
I believe the answer to your original question lies here:
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).
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 main.cf, 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.
Thanks!