| Linode Forum https://forum.linode.com/ |
|
| Mail works for user@host.domain but not for user@domain https://forum.linode.com/viewtopic.php?f=11&t=5359 |
Page 1 of 1 |
| Author: | kdog [ Sun Mar 28, 2010 1:40 am ] |
| Post subject: | Mail works for user@host.domain but not for user@domain |
I just took the plunge and got my first linode today. Yeah! 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 (support@nebulocity.net) in the mail.domains table, I also created a corresponding user on the system. [2] Now mail sent by user 'support' appears to come not from support@nebulocity.net but from support@zathras.nebulocity.net. Conversely, mail sent to support@zathras.nebulocity.net arrives in the 'support' mailbox but mail sent to support@nebulocity.net 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. Thanks, K Dog [1] The A records for mail.nebulocity.net and www.nebulocity.net seem to have propagated. I have requested an A record for zathras.nebulocity.net, but I don't think it has propagated yet. [2] This would be a good thing to add to the Guide. |
|
| Author: | kdog [ Sun Mar 28, 2010 3:00 am ] |
| Post subject: | Maybe I'm on the wrong track. |
* Update Start 2010-03-28 * Ok, try this... Mail sent from joschmo@gmail.com to support.nebulocity.net does in fact get delivered! If as root I run 'mutt -f .' in the directory '/home/vmail/nebulocity.net/support/Maildir' 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 support@zathras.nebulocity.net. Strange...starting to look more like a permissions issue. * Update End 2010-03-28 * |
|
| Author: | kdog [ Sun Mar 28, 2010 6:41 pm ] |
| Post subject: | |
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 'mydomain.net' for the moment. Code: mysql> use mail Now let's send to emails, back-to-back, from an outside account (gmail) to support, first as support@mydomain.net and then as support@hostname.mydomain.net. Mail sent to 'support@mydomain.net' never shows up in mutt when I am logged in as 'support' -- but mail sent to 'support@hostname.mydomain.net' *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/mail.info and /var/log/mail.log are *identical*. (I checked with diff(1).) Seems redundant? Code: Mar 28 15:10:09 hostname postfix/smtpd[3992]: connect from mail-pw0-f52.google.com[209.85.160.52] As you can see, mail sent to support@mydomain.net 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 support@hostname.mydomain.net 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/main.cf: Code: ... where 'hostname' is the host name in /etc/hostname. Could that be the problem? I based that on http://library.linode.com/email/postfix/postfix-dovecot-mysql-ubuntu-9.10-karmic#configure_postfix_to_work_with_mysql. I want all my mail handled by postfix+dovecot. Please help if you can. Thanks. |
|
| Author: | kdog [ Sun Mar 28, 2010 6:53 pm ] |
| Post subject: | [SOLVED] Recommend Change to Guide document |
AHA! Sure enough! I edited /etc/postfix/main.cf as follows: Code: mydestination = hostname.mydomain.net, localhost, localhost.localdomain becomes Code: #mydestination = hostname.mydomain.net, localhost, localhost.localdomain and lo! mail sent to 'support@mydomain.net' works like a champ! I think maybe the Guide http://library.linode.com/email/postfix/postfix-dovecot-mysql-ubuntu-9.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. |
|
| Author: | haus [ Tue Mar 30, 2010 5:31 pm ] |
| Post subject: | |
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. "support@mydomain.com" 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 john@mydomain.com 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 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 postmaster@mydomain.com and postmaster@hostname.mydomain.com both show up in postmaster@mydomain.com's virtual mailbox. |
|
| Author: | kangaby [ Wed Mar 31, 2010 6:31 am ] |
| Post subject: | |
My guess is that some tutorials are trying to thwart spam that is blindly sent to anyone_and_everyone@domain.com by setting up their systems to use blah@hostname.domain.com Don't know how successful this is though. |
|
| Author: | haus [ Wed Mar 31, 2010 10:33 am ] |
| Post subject: | |
Postfix will automatically reject mail for unknown users. From the Postfix readme: 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: http://www.postfix.org/BASIC_CONFIGURAT ... 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). |
|
| Author: | kdog [ Wed Mar 31, 2010 4:13 pm ] |
| Post subject: | |
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 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! |
|
| Page 1 of 1 | All times are UTC-04:00 |
| Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |
|