Tags:
create new tag
, view all tags
This page is a working page to create and document an email server on my home LAN, on a Linux Mandrake 7.2 box (most likely).

Process Steps:

  • Collect all my notes from TWiki pages on SourceForge and at home and consolidate them here.
  • Move them to Word for editing / refactoring / additional development, store them on a new page EmailServerImplementation which will gradually develop into the main page for this "project".

Accordingly, while editing in Word, I will use TWiki markup for most purposes (I will also use Word collapsible outlining which should make life interesting).

Pages to collect data from:

ProcmailRewriteRules page

To: Harvey T. User <huser@fast.net>

Rule: $* < $+ >

Anticipated Result:
$1 = Harvey T. User
$2 = huser@fastPLEASENOSPAM.net

Rule: $* < $ @ $ . $ >

Anticipated Result:
$1 = Harvey T. User
$2 = huser
$3 = fast
$4 = net

Are there email addresses with more than one "."?

Rule: $* < $ @ $ >

Anticipated Result:
$1 = Harvey T. User
$2 = huser
$3 = fast.net

Now I need filters or something to, for example, do:

If $1 = Harvery T. User then readdress to dad@System8.Home
Elseif $1 = Mrs. Harvey T. User then readdress to ruth@LivingRoomPLEASENOSPAM.Home

Also need to handle mailing list addresses (things meant for me that are addressed to, for example, abi-dev@abisourcePLEASENOSPAM.com -- they seem to have my address included somewhere, like within a "received by" header).

-- RandyKramer - 12 Jun 2001

Linux.Email

(see also EMail)

Programs:

Resources:

  • Mail User HOWTO

  • Linux: Network Administrator's Guide, O'Reilly, Olaf Kirch and Terry Dawson, (BPL), ISBN 1-56592-400-2, 1993, 2000. -- Might be good, doesn't cover Samba, which is my current interest. Ahh! But it does cover sendmail and exim, and it looks like pretty good coverage and points out that sendmail is much simpler to configure now that it has macros.

My Goals

I should write down what I need / want to accomplish, then start gathering information.

It looks like sendmail might have two mechanisms to help distribute mail addressed to one internet email address (like rhkramer@fastPLEASENOSPAM.net) to multiple users sharing that address. (Rewrite rules and aliases -- are there also filters?)

In some cases:

  • mail is addressed to, e.g., Randolph H. Kramer <rhkramer@fast.net>
  • (mailing lists) mail is addressed (or cc'd) to a mailing list, like abi-dev@abisourcePLEASENOSPAM.com. (How does this get to rhkramer@fastPLEASENOSPAM.net in the first place? Looking at some of the other headers, they have notations within some of the Received by headers, like for <rhkramer@fast.net>.)
  • probably other cases

I'd like to set up mail so some goes to, for example, dad@Office6PLEASENOSPAM.Home and some to ruth@LivingRoomPLEASENOSPAM.Home, and perhaps some to both, and any that can be determined to a designated address.

If I set this up, the box running sendmail should be the only box that checks and downloads mail from the ISP, and the other boxes should get and send their mail to this box. (This box would then forward the mail to the ISP.)

Should I enable mail service directly between boxes, for example dad@Office6PLEASENOSPAM.Home and ruth@LivingRoomPLEASENOSPAM.Home? If so, how, or should sendmail serve as our local ISP, and the boxes look to this box for a pop3 server and an smtp server (and maybe an nntp server)? Probably need to this in any case, so Windows mail clients can get mail (I think they depend on pop3/smtp/imap).

Now, should I draw a diagram? (It usually helps.)

Rewrite Rules

Sn
Rlhs rhs
Rlhs2 rhs2

$j = fully qualified domain name (of an address)
$w = hostname component of a FQDN
$m = domain name component of a FQDN

Some lefthand rules:

$* < $+ >

If applied to "Head Brewer <brewer@brew.com>", the rule would match -- "Zero or more tokens, followed by the < character, followed by one or more tokens, followed by the > character." On the right hand side, $1 would be replaced with "Head Brewer", and $2 would be replaced with "brewer@brewer.com".

Here are the headers from a typical mailing list message:

Return-Path: <owner-abiword-dev-outgoing@abisource.com>
Received: from imr2.fast.net (imr2.fast.net [198.69.204.71])
        by post6.fast.net (Mirapoint)
        with ESMTP id ABP00378;
        Mon, 26 Feb 2001 06:27:01 -0500 (EST)
Received: from mx1.fast.net (mx1.fast.net [198.69.204.98])
        by imr2.fast.net (Mirapoint)
        with ESMTP id ABD59602;
        Mon, 26 Feb 2001 06:27:01 -0500 (EST)
Received: from parsons.abisource.com (parsons.abisource.com [206.185.0.93])
        by mx1.fast.net (8.11.2/8.9.3) with ESMTP id f1QBQxS03330
        for &lt;rhkramer@fast.net>; Mon, 26 Feb 2001 06:26:59 -0500 (EST)
Received: by parsons.abisource.com (Postfix)
        id EBFB313B89B; Mon, 26 Feb 2001 05:26:48 -0600 (CST)
Delivered-To: abiword-dev-outgoing@abisource.com
Received: by parsons.abisource.com (Postfix, from userid 30)
        id CFB1413B89C; Mon, 26 Feb 2001 05:26:48 -0600 (CST)
Delivered-To: abiword-dev@abisource.com
Received: from mtiwmhc27.worldnet.att.net (mtiwmhc27.worldnet.att.net [204.127.131.52])
        by parsons.abisource.com (Postfix) with ESMTP id 9B7D913B89B
        for &lt;abiword-dev@abisource.com>; Mon, 26 Feb 2001 05:26:46 -0600 (CST)
Received: from rjcjr ([32.100.110.13]) by mtiwmhc27.worldnet.att.net
          (InterMail vM.4.01.03.16 201-229-121-116-20010115) with SMTP
          id &lt;20010226112645.WHOZ27260.mtiwmhc27.worldnet.att.net@rjcjr>;
          Mon, 26 Feb 2001 11:26:45 +0000
Message-ID: &lt;004401c0a054$b7babee0$0d6e6420@rjcjr>
From: "Rob Campbell" &lt;rob.campbell@worldnet.att.net>
To: "Tom Briggs" &lt;tomabi@jules.briggs.cx>,
        "Dom Lachowicz" <cinamod@hotmail.com>
Cc: &lt;abiword-dev@abisource.com>
References: &lt;Pine.LNX.4.20.0102251854260.24866-100000@jules.briggs.cx>
Subject: Re: Request for help: problems with Win32 build
Date: Mon, 26 Feb 2001 19:32:05 -0500
MIME-Version: 1.0
Content-Type: text/plain;
        charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
Sender: owner-abiword-dev@abisource.com
Precedence: bulk
X-Mozilla-Status: 0011
Content-Length: 1128

2001-02-26
-- RandyKramer - 12 Jun 2001
(transferred from swiki)

Linux.EMail

Email in Linux can be confusing, especially coming from a Windows background. One reason for the confusion is that, in Windows, when most people talk about an email program, they are referring to an email client which connects to an ISP's pop3 and smtp (or imap) servers. Many Linux/Unix enthusiasts are more familiar with an email "system" consisting of several programs to create a complete local mail distribution system.

Overview of a (Linux/Unix style) email (distribution) system

A complete mail distribution system in Linux might include the following types of programs:

  • An MTA (like sendmail, postfix, or qmail) which can accept mail (somehow, perhaps "at port 25") and distribute it to mailboxes (files or directories) on the Linux box, and perhaps (if it also works as a pop3 server) allow mail clients on other local computers to fetch their mail from mailboxes on the box running the MTA. (add accessing mail on other local computers using an imap server).
  • An MUA (like mutt, pine, ...) which is the user client for email, the interface where a user reads, replies to, and writes email. Some Linux clients can act like a typical Windows client, interfacing to mail stored on another computer using pop3, smtp, or imap servers on that other computer, some cannot. Typically (historically?) mutt and pine cannot (??). Newer Linux tools, like kmail, sylpheed, evolution, ... can. An email client that does not act like a typical windows email client typically reads mail from a directory or file on the local computer. (There are something like mboxes and maildirs -- I'll include them in #Terminology.)
  • (Possibly) a program like fetchmail (or getmail?) which can connect to an ISP's POP3 server and fetch mail from it to the Linux box's MTA (by presenting the mail at port 25??).
  • (Optionally) a program like procmail which helps sort and redirect mail. Among other things, it can read mail from one mbox or maildir, and sort it to other mboxes or maildirs based on rules specified using procmail syntax.
  • A pop3 server (unless it is part of the MTA?) which allows email clients on other computers to fetch mail from the computer running the MTA (it allows clients on other local computers to fetch mail from an mbox or maildir where it was put by the MTA).
  • An smtp server (unless it is part of the MTA?) which can receive email from email clients on other computers and put it into the purview of the MTA so it is handled like other mail -- i.e., distributed locally or forwarded to an external smtp client for forwarding to a final destination anywhere on the Internet. (What do I mean by "purview of the MTA" -- put it into an incoing mbox or maildir so the MTA can move it to something to send it to the ISP -- does it put in in an outgoing mbox or maildir for pickup by the ISP (no, I don't think so), or does it act something like an smtp client to present the mail back to the ISP (on port 25, or 11x), (and, for a dial up connection, how does it know when to do that).
  • An imap server, which in some senses is an alternate to pop3 and smtp. If your local email client is an imap client (i.e., it can use an imap server), the net result includes that your email is not fetched to your local computer but instead remains on the computer with the MTA and so forth.

Maybe I need to straighten out (or create) some other terminology -- maybe I should describe (and name):

  • a (local) email client on a (local) LAN
  • the mailserver on the (local) LAN
  • the hierarchy of mailservers, starting with, for example, your ISP's mailserver, that "relay" your email from mailserver to mailserver until it reaches the final destination.

I probably also need to clearly delineate and separately describe the path of mail coming to you and going from you to someone else.

Overview of a Windows style email client

Just haven't written so far, I think I know enough to start the description. The primary distinction is that the pop3/smtp approach actually moves mail to and from the email client on the local client computer, the imap approach leaves the mail on the (local) email server, and just allows remote reading and writing of the mail (files) on the local (last) email server.

pop3 / smtp based

imap based

Some alternate lead ins

< All rough and unfinished>

Black Magic Approach

If you come from a Windows background, and you've set up an email client it has been one of two types:

  • pop3 / smtp based (older)

  • imap based (newer)

In either case, you may have know that somehow, your email client dealt with your ISP to send and receive email. You may never have thought about the "magic" that the ISP does to send that mail to it's final destintation, or to get your mail from whoever sends it you to you. (There's a whole part of the story that you may never have thought about.)

In Windows based email, most people can ignore that story (unless they are setting up a mail server). A traditional Linux/Unix email systems is a mail server, and includes all that magic, and understanding all that magic can make the story seem complicated, ... (the elephant and the blind men, etc.).

Terminology

Currently just a list of terms that I should define:

  • MTA
  • MUA
  • Windows style (integrated?) email client
    • pop3 / smtp based
    • imap based
  • Linux/Unix style email client
  • maildir
  • mbox
  • home directory and terminology (like ~/.mailbox?)
  • LAN (partially for any newbies that don't know, and partially also to explain that when I say local LAN I am being redundant, but intentionally so, for the purpose of trying to specify which mailserver I'm talking about)
  • (a) share (as a noun)

Overview

(This is older, and was written before the above. There might still be good stuff that I should salvage and incorporate above. (or vice versa))

There are several things you might want to do with email:

  • Send and receive email (Read email sent to you, write email to others)
  • Route email (act as an email server) for several other machines on your home LAN

My first goal is to send and receive email. My problem is complicated by the fact that my family and I share one email address. Currently we have several Windows computers. One computer acts as the master email machine. Email is sent, received, and stored at that machine by Netscape Navigator 3.01. All of the other machines can also send and receive email (using Netscape Navigator 3.0x), but the mail is not stored on those machines. They use the directory on the master email machine. (In other words, the directory on the master email machine is shared over the network (LAN).)

I could try to set up sendmail or some other mail server and handle the mail differently. For example, even though we each use the same basic address (rhkramer@fastPLEASENOSPAM.net), we can also "qualify" our email addresses using the format: "Randy Kramer <rhkramer@fast.net>" (vs., for example "Ruth Kramer <rhkramer@fast.net>". I hope (but don't know) that sendmail can be configured to send mail to different machines based on that qualification. An alternative to that might be to set up our own local email addresses within our own local domain. I'm not sure if that can work or how to set it up if it can work -- perhaps the email addresses would become something like rhkramer@homePLEASENOSPAM.fast.net? (Because I use "Home" as the domain name of my home LAN.)

But all of that sounds too complicated for me at this stage of my Linux sojourn. What might be easiest would be to share email the same way we do it today, except that my Netscape Navigator 3.0x would be a Linux version, on a Linux machine.

Aside: I've read that many email clients use the same storage format for email. I was hoping that I could use KMail as my email client while the rest of my family continued to use Netscape Navigator. This might work, but in some quick trials, KMail would not open in the directory containing the Netscape files because it could not find an inbox that it "liked". I might follow up on this later -- I do believe that many email programs store their mail in similar formats, but with some differences, perhaps in the index file, which some mail clients use and some don't.

Further Aside: I believe that Outlook (and Outlook Express) are two email clients that use storage formats incompatible with most other programs.

Further Aside: I was surprised to find that even Netscape Navigator 4.x for Linux was not sufficiently compatible with the storage format for Netscape Navigator 3.01 for Windows. The index files were not compatible. The "incoming mail" files were read Ok by Navigator 4.x, but the index and "outgoing mail" "sent" files could not be read. This might be due to a basic difference between Windows and Linux (for example, lines ending with in Windows but only in Linux).

Currently I have downloaded Netscape Navigator 3.0x for Linux and am attempting to install it. We will see how that works. Update: After some struggles with shared libraries and so forth (which I may not have recorded properly so I can redo the installation), I got Navigator 3.0x installed and was not impressed -- it looks much uglier than the Windows version and doesn't have the same functionality -- I could not find a way to resize the panes. Since I don't recall otherwise, I'm assuming that it successfully accessed the mailboxes on the main email computer (Windows) --- I probably set up a "share" using smbclient.

See InstallingNetscapeNavigator3xx

back to:
Table of Contents
WebHome
-- RandyKramer - 11 Jun 2001
(transferred from swiki)

Linux.Postfix page

Links

PostFix page

Resources:
  • Postfix home page
  • Redhat Postfix FAQ (copied below)
  • Redhat Postfix Howto
  • man formail
  • man sendmail
  • pickup(8) mail pickup daemon
  • postalias(1) maintain alias database
  • postdrop(1) privileged posting agent
  • postfix(1) mail system control
  • postkick(1) kick a Postfix daemon
  • qmgr(8) queue manager
  • showq(8) list mail queue
  • smtpd(8) SMTP server
  • syslogd(8) system logging

3.14

How can I use Postfix from my dial-up machine at home?

There is a very good discussion about this in section 9.1.1 (The Stand Alone Config) of the Red Hat Postfix HOWTO. The key components required to setting this up are as follows:

# your ISP's SMTP server name or IP address goes here
relayhost = smtprelay.someprovider.com
#
# this line disables spontaneous PPP connections
defer_transports = smtp
#
# this line disables dns lookups for mail. As you are using a relay you # really don't need DNS. If you use this you should use an ip address 
# for $relayhost.

disable_dns_lookups = yes

Put the following command into your PPP or SLIP dialup scripts:

/usr/sbin/sendmail -q (whenever the Internet link is up)

4.3

I am a dial-up user and I've done everything right so far (I think). I can get my mail just fine with fetchmail and mail works locally as it should. The trouble is that my user name on my local account is not the same as my user name at my ISP so my mail goes no where when I send it. What can I do to fix this?

Aside from changing your local user name to match your ISP account name there is a simple fix for this which works quite well. Here's what to do:

A canonical mapping should be all that is needed but you have to edit main.cf so that Postfix actually looks at the table by adding this line to /etc/postfix/main.cf:

canonical_maps = hash:/etc/postfix/canonical

Add something like the following to /etc/postfix/canonical:

username@hostname user@ISP

Be sure to run postmap /etc/postfix/canonical after each change. Then run postfix reload.

What the canonical map does is rewrite the address, in any message it processes, when it sees a match. In our example from above if the map saw the address on the left it would rewrite it to the one on the right.

-- RandyKramer - 12 Jun 2001

ChurchServerProjectResources page

Mail

Postfix
From Google search on [postfix mail server user manual]

Procmail

PostfixResources page

A list of resources for using and installing postfix.

man pages

I think I might copy each of these to a WikiLearn page, then start condensing and annotating them, then finally print them out. This approach partly because I don't think I can currently print from my Linux machine (Mandrake 8.1 -- nope, don't look good -- nothing appears to be configured), and partly to make the whole thing more manageable (i.e., smaller) by condensing and annotating. I'm also making a new search on the web for HOWTOS -- I didn't get much out of the RedHat postfix HOWTO when I read it 6 months to a year ago, but I may have the groundwork in Linux now to understand it better. (I know now, for example, what things like ~/ and $HOME mean, and other similar things (permissions and file ownership) that appeared cryptic to me before.)

I guess in order to import these man pages to WikiLearn I need to use the command discussed on the Mandrake newbie list:

man <manpage> | col -b > <file for manpage>

Hmm! that will be a pain -- col filters out reverse line feeds, but I will still have a lot of doubled characters (I think) -- I wonder if these are available in plain text somewhere? Ahh, OK, col also gets rid of the doubled characters, but leaves the paragraphs "preformatted" with indents (spaces) etc. I've written to the list to see if there is a prebuilt filter like col that will deal with this. Also, I've found all(?) the postfix man pages (and more) on the Mandrake install as HTML -- this could be a better starting point, especially if I find an HTML to text filter. (Sounds like something likely to exist.)

  • man 1 postfix -- Postfix control program
  • man 8 master -- Postfix master program
  • man 8 qmgr -- queue manager
  • man 8 pickup -- local mail pickup
  • man 8 syslogd -- system logging
  • man 8 trivial-rewrite -- address routing
  • man 5 relocated -- format of the "user has moved" table
  • man 8 cleanup -- message canonicalization
  • man 5 canonical -- canonicalize and enqueue mail
  • man 5 virtual -- virtual domain mapping
  • man 1 postmap -- create mapping table
  • man 5 pcre_table -- format of PCRE tables
  • man 5 regexp_table -- format of POSIX regular expression tables
  • man 5 transport -- transport table format

These are the man pages I found by reading man postfix and then following the "chained" references. I've now found additional man pages in the postfix documentation directory (in HTML). I will consider adding these to the list.

I think the way I want to learn postfix is by having a handle on what each of the individual programs do, and conceptually (or actually) creating a drawing that shows the flow of messages -- like messages arriving at port 25, being moved to the "master" inbox by the "xxx" program, etc.

I guess TWiki, with the drawing plug in, would let me create such a drawing, but I'm more tempted to do it in Visio or on paper. (Otherwise I have to learn something else frown <grin>.)

Contributors

  • RandyKramer - 11 Feb 2002
  • <If you edit this page, add your name here, move this to the next line>

See also:

Contributors

  • RandyKramer - 12 Feb 2002
  • <If you edit this page, add your name here, move this to the next line>
Topic revision: r1 - 2002-02-12 - RandyKramer
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by PerlCopyright 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding WikiLearn? WebBottomBar">Send feedback
See TWiki's New Look