Here's a News post that I wrote in response to a question about mail servers. Someone suggested that it deserved to be archived, so here it is, for whatever use it may be of to people. Other folks are welcome to copy it freely but I'd be glad if it was attributed to me. Naturally, the information is provided as-is and without any warranty.
Path: news.mondoinfo.com!matt
From: matt@mondoinfo.com (Matthew Dixon Cowles)
Newsgroups: visi.help
Subject: Re: Redhat 5.2 and mail serving question [long]
Date: Mon, 08 Mar 1999 19:58:16 -0600
Organization: Mondo Info
Lines: 128
Distribution: local
Message-ID: <matt-0803991958170001@scotch.mondoinfo.com>
References: <oKEE2.347$to3.14795@ptah.visi.com>
NNTP-Posting-Host: scotch.mondoinfo.com
X-Newsreader: MT-NewsWatcher 2.4.4
Xref: news.mondoinfo.com visi.help:4444
In article <oKEE2.347$to3.14795@ptah.visi.com>, "Jeffrey
S. Kline"
<jskline@visi.com> wrote:
> Hi;
> To any and all who (you guru's know who you are!) know about
this sort a
> stuff...
I'm probably not a guru but I'll see what I can do to help.
But if this
helps, promise me that you'll stop posting to newsgroups from
Outlook with
quoted-printable text and HTML <0.5 wink>.
> I am trying to set up my own local mail server on
a linux box. It's
> Redhat 5.2, fully updated kernals and all, doing connects
to Visi with
> ipforwarding and all. What I want is a local mail demon that
I can
> connect to using win clients, pine and such on linux workstations
and
> all. This should also spool mail from my visi mail account
as well with
> forwarding to my local mail. I've understanding of some of
it, but so
> far, all the stuff on sendmail, fetchmail, procmail, and
all the others
> is beginning to get highly confusing. Can someone point me
in to where I
> need to look at to do this kind of thing.
Mail is conceptually very simple -- you edit a file and
send it to someone
else who can read it. But partly for historical reasons and partly
for
efficiency reasons, things are a little more complex than they
look like
they'd be at first.
By convention, the job of moving mail around is divided
into various steps
that are often accomplished by different programs. The program
that you
use to create and read mail is called a mail user agent or MUA.
When you
send a message, your MUA hands the message off to a program that
is in
charge of getting it to the machine that the recipient's mailbox
is on.
That program is a mail transfer agent (MTA). MUAs talk to MTAs
(and MTAs
talk to other MTAs) using Simple Mail Transfer protocol (SMTP).
When the
message gets to the machine that the recipient's mailbox is on,
the MTA
there has a mail delivery agent (MDA) save it to the recipient's
mailbox.
The MTA that your MUA talks to needn't be the one that's
running on the
machine that has the recipient's mailbox on it. That's because
Visi's MTA
will relay the message for you. It will accept a message from
you and then
get on with the job of figuring out where the message ought to
go and
getting it there. There's an important issue here: MTAs need to
be
configured to relay for the right folks but only for them because
spammers
love to use other people's relays to send their spam. I had a
long talk
with one this noon who maintained that if a relay was open, it
was just
fine for him to use it.
Some years ago when most everybody who got mail read it
from a shell
account, that was all there was to it. Your MUA would display
your mail
directly from your mailbox. That's what happens now if you dial
in to
Visi's shell machines with a terminal emulator and read your mail
with
mutt or elm.
But then people got PCs and connected them to networks.
And they wanted to
be able to read their mail on their PCs rather than by logging
in to a
shell machine. It wouldn't have been a good idea to try to deliver
mail
directly to a user's PC since they're often turned off at night
and so on,
so it was necessary to invent a way to suck mail from a user's
mailbox on
a mail server to a user's PC. For that purpose, Post Office Protocol
(now
in its third incarnation, POP3) and later Internet Message Access
Protocol
(IMAP) were invented. Modern MUAs can generally speak one or both
of these
protocols.
So what does that mean to you? Since you want to have your
local clients
send mail through your Linux server, you'll need an MTA. Sendmail
is by
far the most common but it's considered by many (including me)
to be a big
PITA to configure. Some folks use qmail but it's not very flexible
and
many people (including me) consider its author to be uncivilized.
I use
Postfix (described at www.postifx.org) which I find to be easy
to
configure and very reliable despite being in beta test. Since
you're a
customer of Visi, you can tell your MTA to send all outgoing mail
to
mail-out.visi.com and let it relay for you. Unless you have a
lot of
outgoing mail, there's no reason not to do that. You'll also want
to test
your configuration carefully to make sure that it only relays
for the
right machines.
You have a couple of choices of how to get mail to your
mail server. Using
Fetchmail is one good way. It can connect to mail.visi.com and
collect
mail from your mailbox using POP3 or IMAP and give it to your
MTA as
though it was a remote MTA that was talking to your MTA. There's
one
disadvantage to doing that: some addressing information is lost.
I'm sure
that you've noticed that mail has From: and To: headers. But what's
not so
obvious is that they don't mean much. When mail is transferred
using SMTP,
the sender and the recipient are specified before the mail is
transferred.
So there's no reason that the actual recipient has to be the person
named
in the To: line of the mail message (though of course it generally
is).
That's how spam arrives in your mailbox without appearing to be
addressed
to you. Legitimate mailing lists generally take advantage of this
feature
too. It means that the mailing list software doesn't have to gin
up a new
message for every recipient.
If you're the only person receiving mail in your Visi mailbox,
there's no
problem: if the mail is there, it must have been addressed to
you. But if
you're receiving mail for more than one person in that mailbox,
you'll
have to provide a sensible default place to send mail that doesn't
have a
To: line that tells you whom it's for. That's generally not a
big problem
and I know several small companies that handle their mail that
way but
you'd want to be aware of it.
Another thing you can do is ask Visi not to put your mail
in a mailbox and
instead to relay it onward to your mail server. If you have a
dialup
account, that imposes some burden on Visi's mail server because
it has to
try to connect to your mail server every once in a while and if
you only
dial up from time to time, Visi's server may spend a fair amount
of time
trying to deliver a message before it can contact your mail server.
You
can speed the process up somewhat by issuing an SMTP command to
Visi's
server that says "please send any mail you have for me now"
but that
doesn't save it the attempts it makes while you're not connected.
I'd be a little surprised if the folks at Visi were prepared
to do things
that way unless you had a domain name hosted with them. But then
if you
didn't, using Fetchmail ought to work just fine.
That leaves only Procmail, I think. Procmail is a replacement
MDA. It can
do lots of things (file messages here or there, bounce them, etc.)
depending on the contents of the message it's being asked to deliver.
Mostly, folks only have it look at the headers of the message
and often
they have it look for things that make it likely that the message
is spam.
One common use is to have it see if the message is addressed to
you and,
if it isn't addressed to you and it doesn't appear to be from
one of the
mailing lists that you've told it about, treat it as likely to
be spam.
I'm no big fan of Procmail's configuration syntax but I use it
because it
works well and efficiently.
I hope that helps. If it raises more questions, go ahead
and ask them but
I won't threaten to answer again at this length.
Matt