# local mail servers - imap, qmail, fetchmail.. which mail!?

## emerge newbie

I recently read the desktop config guide and was reading into setting up Squirrelmail. I now have Squirrel mail up and running (that part was easy) and after some reading have Qmail setup to deliver my outgoing email from my domain, and this works fine. The problems I am having now are getting a server setup to accept incoming mail to my domain (eg. a reply to a message I sent using qmail), I am really confused!

I have courier-imap up and running properly and after reading have fetchmail installed but I still don't seem to be receiving incoming email at all. I check for new mail using mutt first (mutt -f imap://localhost), but no mail ever comes!

Could someone please clarify exactly what IMAP and fetch do please? Do I even need fetchmail installed for what I want to do? It could also be a firewall issue, what ports would I need forwarded from my router to my Gentoo box?

Thanks guys, these forums have been so useful so far!

----------

## klieber

 *emerge newbie wrote:*   

> Could someone please clarify exactly what IMAP and fetch do please?

 

IMAP is a way of accessing mail stored on a remote server.  If you want more detail than that, check out [url]imap.org[/url].  "Fetch" (by which I'm assuming you mean the program fetchmail) simply retrieves email from another server and forwards it to your local SMTP server so it can be read locally.

If you're not receiving any email at all on your computer, chances are you have fetchmail configured incorrectly.  Good resources on fetchmail are the man page and the fetchmail FAQ.

Take a read through those docs/sites and see if that doesn't clear up some of your confusion.

--kurt

----------

## emerge newbie

It cleared things up a little bit, but I am still confused as to which program monitors incoming emails? Like if someone sent an email to my box which program would monitor for it? And which port on my router would I need to forward for it to work?

Thanks.

----------

## djrogers

You really have two options for this, easy and less easy.  

1)  It sounds like what you're looking for is an SMTP server (aka an MTA - message transfer agent), which will sit on port 25 and listne for incoming requests to relay mail.  Sendmail and Postfix are two common options for this type of arrangement.  In addition to the hassles of setting up and securing this, you'll also have to get the MX record for your hostname pointed to your box and ensure that your ISP allows SMTP MTAs on their network (many broadband providers block inbound port 25).  If you're running a coporate box here, and need ot provide mail for a bunch of people, this is probably the way you want to go, howver....

2)  If you only need to provide mail for a handful of people (like, a family for example) you can use a service like redirection.net or zoneedit.com to redirect email to a POP3 mailbox provided by your ISP and use fetchmail to pick it up and hand it off to an MDA (message delivery agent) like such as procmail to sort and deliver it to your local users.  This is really easy to set up, and lets you do things like turn your server off and not worry about missed email because your ISP is running their mail servers 24x7.

Hope this helps!

----------

## emerge newbie

Yes thankyou, it did help  :Smile: . Now the only problem I have is retreiving mail from the mail server. I know there is mail on it, but I can't seem to get it off. My setup is as follows:

```

--- ~ internet ~ ---> firewall ---> |---> my linux box

              (gw.domain.no-ip.com) |(linux.domain.no-ip.com)

                                    |

                                    |---> other machines

```

The software I am using is:

- qmail (for SMTP)

- fetchmail (or) maildrop (for taking the messages off qmail)

- courier IMAP (all packages) is installed along with squirrelmail

- mutt (to test IMAP and check for messages)

I can send mail fine, that isn't a problem.. but I can't seem to receive mail. When I try and configure fetchmail using fetchmailconf the only "server" I can check is 'localhost'. If I try and retrieve mail from linux.domain.no-ip.com, or domain.no-ip.com I get 'access denied' errors. When I check 'localhost' it says there is no mail for my users on it. I have port 25, 143, 80 and 443 open on my firewall.

Does anyone have any clues to why I can't receive mail? If I get this working I might write up a newbie mail server how-to.

----------

## Messiah

You do not need to use fetchmail in this config, because mail is already being received on this one right? So Qmail already receives the mail, and fetchmail is being used for what? You need to make sure that qmail stores the mail for your users in a maildir which courier-imap can read. I think this is somewhere like ~/.maildir on a default install. If a user does receive e-mail, it should show up there. And with courier-imap you have direct access  to that directory (that is, if configured properly, but I think it is in a default install).

Now maybe I am telling you nonsense, because I do use Qmail in a whole different setup, namely with vpopmail. Life with qmail changes a lot if you are using vpopmail  :Wink: 

----------

## whit

 *emerge newbie wrote:*   

> Yes thankyou, it did help . Now the only problem I have is retreiving mail from the mail server. I know there is mail on it, but I can't seem to get it off. My setup is as follows:
> 
> 

 

I'm vague on which are your mail servers with mailboxes you're trying to fetch mail from. Fetchmail is for use when the mail is sitting on another machine and you want to fetch it. To check that the other machine is accessible try "telnet the.othermachine.com 25" - you ought to see the prompt from the mail daemon there. If you can see that, then hand edit your .fetchmailrc file to have a line for that machine that specifies your remote login, as well as your identity (if different) on the local machine. For more on Fetchmail see http://www.tuxedo.org/~esr/fetchmail/.

----------

