Postfix + Dovecot setup - is it really this hard to set up?
I am running a few web sites on Debian 6 Squeeze, and I have followed this tutorial:
I have about 3 domains and each domain has from 1 to 3 email account, so I really want to go with the virtual user route. But, it's just not working. I have thoroughly followed the steps outlined in the article, but things just don't seem to work.
I setup everything fine, I am able to send a message from my Gmail account to my own email server, but I cannot retrieve it either through Thunderbird nor through anything else.
I have read the comments under that article, followed their advice, but still nothing. So, my question is: is it really this hard to set up a mail server? I mean, I am so confused about everyhing.
Basically, I want my email server to be set up at mail.mydomain.com and smtp.mydomain.com (IMAP+SMTP combination, obviously), but I just don't know how to properly set up the hostnames, MX records, etc. Can someone tell me where am I going wrong about the tutorial I am following or point me out to some other, useful tutorial.
I have googled and googled and tried just about every tutorial out there, but I have never achieved any reasonable results. Thanks in advance.
6 Replies
Anyway, from a hostname standpoint, you'll want to make sure your system hostname is NOT just plain ol' "example.com" if you want to handle mail for "example.com". Go with "bob.example.com", or "mailsrv1.example.com", or "server.example.com", or whatever, but never "example.com". You'll want to set up an A record from that hostname to its IP address, and then set up reverse DNS from that IP address to that hostname.
The hostname does not have to have the word "mail" in it. However, it would be a good idea to create another A record, mail.example.com, pointing at the same IP address. This will be what you'll point MX records and mail clients at.
You then have three things you have to worry about:
1) Incoming mail via SMTP. This is handled by Postfix. On each domain you want to accept mail for, you'd set up a domain and some users
Make sure that example.com (or whatever the domain(s) are) does NOT appear in the mydestination setting for Postfix. Otherwise, your mail will go somewhere you aren't expecting it to.
If this is working well, messages to
2) IMAP connections from users. These are handled by Dovecot. I don't use Dovecot. If this is working well, you should be able to connect via IMAP, authenticate as
3) Outgoing message submission from users. These are handled by Postfix, typically using some sort of SMTP authentication, and often on port 587 ("submission") instead of the usual 25. It doesn't sound like you've gotten this far yet, but you should be able to send an outgoing message, authenticating as
Posting a better problem description, logs, and/or config files might be helpful, as well.
That was the only snag I had using the same tutorial. That is also when I learned I can chage it from the default. I never went as far as to set up DNS for smtp., mail., or pop. domains. I just use the FQDN in the mail server MX record and use the same in client setup.
It was a headache for a few days but it was a nice learning experience. I created a stack script to automate it to save time in the future as with everything I do/learn on my linode.
When you get it working you may be interested in setting up clamav, amavis and spamasassin. Good tutorial for that here >
My question is: when I rebuild a Debian 6 x64 Linode and start from scratch, what exactly do I put in /etc/hosts and /etc/hostname files?
And after that, when I setup Postfix and when I select Internet Site, what do I type in the mail domain name? Just the domain, or mail.mydoman.tld?
These are some beginner questions that I am not able to find an answer for. I'm not setting up a mailserver for a lot of people. In fact, those are my domains and I just need about 5 or 6 mailboxes spread across 3 domains, but I would still like to go with virtual users thing.
@petarpetrovic:
My question is: when I rebuild a Debian 6 x64 Linode and start from scratch, what exactly do I put in /etc/hosts and /etc/hostname files?
Your host/hostame should be the name of your server or FQDN. In my hosts I have zinn01.voidfaction.com and in hostname I have zinn01 because that is the name of my server and my FQDN name that I have set in Linode manager. My FQDN showing in reverse DNS is zinn01.voidfaction.com. If you have not changed your FQDN in the linode manager then the default ismembers.linode.com. You can set your FQDN name in the linode manager to be anyone of the domain/sub you have pointing to your server in the DNS manager a record.
@petarpetrovic:
And after that, when I setup Postfix and when I select Internet Site, what do I type in the mail domain name? Just the domain, or mail.mydoman.tld?
You use your FQDN which in my case is zinn01.voidfaction.com because that is what I get when doing reverse DNS. the smtp.mail.pop are just domain pointers to your server unless you named your server mail.smtp.or pop.
@petarpetrovic:
These are some beginner questions that I am not able to find an answer for. I'm not setting up a mailserver for a lot of people. In fact, those are my domains and I just need about 5 or 6 mailboxes spread across 3 domains, but I would still like to go with virtual users thing.
I can't say I am doing it right I just know that it works. I know not using the FQDN of the server messed up alot like in the ssl cert and email getting blocked or marked as spam because my FQDN did not match in the mail server settings as reverse dns showed in spam filters. I got it set with just the FQDN nothing else as long as it works. Getting the pop/smtp/mail domains to work with email clients only requires that you have the sub domain pointing to the ip address of the email server in the DNS manager. if you web server and email server are on the same server you can usewww.yourdomain.com in client and still reach your email.
I hope that this thread will help the other people who are new to email server setup and wish to take upon this never ending journey. Thank you all once again.