How do I set up a Linux server to receive and store email?
February 4, 2005 6:18 PM   Subscribe

How do I set up a Linux server to receive and store email? (+)

I have root access to a server and I want to receive email for my domain and access it via IMAP. This seems obvious enough but every tutorial I've come across assumes you have at least part of it already working and is about changing part of your setup.

I know how email travels through the network fine, but within Linux I am at a loss as to exactly what each piece of software does and how they talk to each other and so forth. And before that, currently mail just bounces. I can't even find the switch in Postfix to turn on receiving mail.

This is on Redhat 7.3. Even getting the thing to forward mail would be nice. Thanks.
posted by cillit bang to Computers & Internet (10 answers total) 1 user marked this as a favorite
Best answer: Refer to "POP/IMAP and the Kitchen Sink" to get started. In particular...

You might use IMP for a web-based IMAP client.
posted by AlexReynolds at 6:32 PM on February 4, 2005

You'd be better off reading up on the docs or searching for 'postfix tutorial' on google. there's plenty of resources. just keep in mind: smtp is delivery, pop/imap is retrieval.
posted by angry modem at 6:36 PM on February 4, 2005

First, you need a public IP address that a domain name can be resolved to. The external interface of a cable modem is good, but be aware that your ip addy will change. If you direct a dynDNS name towards your cable modem and install the follower app on one of the boxes in your network, and open up the appropriate ports on your router, you'll be fine. THEN you'll need to direct the mx entry of the domain name you want to use (for instance, resolves to one of a bajillion subdomain names that identify specific machines) to the DOMAIN NAME (never ip address!) that points to the IP address that you want.

so ...
MX              Domain                    IP ###.###.###.###

Second, you need to configure a Mail Transfer Agent (MTA) on your box. Postfix and Sendmail are the two standards. Postfix is more advanced than Sendmail, old guys with grey beards use sendmail. An MTA does the actual transferring of mail around the internet ... from your box to your mail server to someone else's mail server.

Third, you need to install imapd or imp or one of the other implementations of imap. POP and IMAP only do the final leg of the inbound email -- the transferring of the email FROM the server directly to your inbox.
posted by SpecialK at 6:49 PM on February 4, 2005

Response by poster: Thanks all. Just to clarify, email is being sent to my ip, and I did manage to get courier working a while ago (as in, I can login), but there's nothing in between to receive the mail and pass it to the courier mailbox, which apparently needs to be a whole mess of spoolfiles and processing rules, and it's those I don't really understand.
posted by cillit bang at 6:58 PM on February 4, 2005

Here is a brief summary of some mail related terminology. There are many options for you to select as an MTA/MDA/MUA etc. I prefer qmail and Life with qmail is a great setup tutorial.
posted by brettcar at 7:38 PM on February 4, 2005

Response by poster: A bit of testing reveals that mail sent from a php script on the same server is delivered to /var/spool/mail/, so something's working. But external mail isn't and the server isn't accepting connections on port 25. IS their a postfix setting do I need to change?
posted by cillit bang at 7:59 PM on February 4, 2005

I use XMail to handle my mail on a linux box. It is an all in one mail server, handling POP, SMTP etc in one package. It is pretty easy to set up if you use one of the simplified network interfaces (i.e. xmailadmin).

Unfortunately there seems to be no documentation for the whole shebang. Still I have been using it for over three years with no problems whatsoever.
posted by phatboy at 10:04 PM on February 4, 2005

i'm not sure i understand your config, but this is what i have:
  • getmail run as a cron job (owned by mail) which grabs email from my isp and sends it to the local mail handler
  • exim running as the mail handler, rsponsible for both receiving email from getmail/sending it to (local) users and receiving email from (local) users/sending it to the isp
  • procmail in my own account to call spamassassin and filter mail into maildir format
  • courier imap to make those maildir directories visible via imap
  • squirrelmail to provide a web interface to the mail
  • mutt as a local email client (both mutt and squirrelmail talk imap to courier
more info, but a bit out of date, here (self link).
posted by andrew cooke at 2:54 AM on February 5, 2005

hehe, I've used both postfix and sendmail, the latter gave me a huge headache the first time I set it up so I switched over to the dreamy postfix which everyone was raving about... and oddly, I missed sendmail so now I'm back to that. Give postfix a go first, It is much less of a headache to install at the start.
Just for SpecialK, I don't have a grey beard. ;)
posted by dabitch at 7:48 AM on February 5, 2005

Response by poster: Ooh, I've got it working. Turns out a long time ago I'd disabled smtp in postfix's because my server came out of the box as an open spam relay. Enabling that got mail received and spooled. I tried to follow the instructions Alex posted to install maildrop, gave up, and randomly tried logging in with an imap client, and all my test mails were there. I genuinely have no idea whether maildrop is involved in the process or not.

Thanks everyone.
posted by cillit bang at 11:56 AM on February 5, 2005

« Older WIll Customs seize my robot pals?   |   IT prospects in English-speaking European... Newer »
This thread is closed to new comments.