On Thu, 30 Jul 1998, Karl F. Larsen wrote:

> 
>       Nope, Pine works great with a standard ppp connect to any isp.
> Here is my paper on using Pine and sorting the mail as it comes in:
> 
>               PINE AND PROCMAIL FOR SORTED MAIL
>                       KARL LARSEN
>                       JAN 1998
> 
> 
> USE PINE:
> 
>       If your planning to run your internet service on Linux then
> here are some ideas that will make doing this a lot simpler than it
> was for me. First decide if you are going to use Pine as your mail
> server. Pine is recommended by me because it's very versital.
> 
Pine is not a mail server.  It is a mail reader.  The server is the
program that actaully sends the mail.

>       Also decide if your going to use a internet provider that
> gives you a fixed IP number or a Dynamic number. As a rule you must
> pay much more for a static IP unless your at a University.
> 
I'm not sure that's true.

>       With a Dynamic IP number you will need to set up your pine
> so that your internet address is that on your Internet Provider's
> computer. You can send out e-mail and run Netscape with a Dynamic IP
> but you must POP your e-mail to your computer from time-to-time.
> 
>       To do this run pine and in the Main window type s and then c.
> This puts you in the configuration window that looks like the one
> below: 
> 
> personal-name            = Karl F. Larsen                                       
> user-domain              = whc.net                                              
> smtp-server              = <204.90.111.1>                                        
> nntp-server              = <No Value Set>                                       
> inbox-path               = <No Value Set: using "inbox">                        
> folder-collections       = <No Value Set: using "mail/[]">                      
> 
> Notice that the second item is "user-domain". What you want to put
> there is the letters that follow the @ in your internet address. An
> example is [EMAIL PROTECTED], and the user-domain is nmsu.edu
> 
>       Save this change and now all your mail will carry the address
> of your internet server. Here is another thought. My real internet
> address is [EMAIL PROTECTED] with the user-domain shown above, whc.net,
> but to get the return address to show [EMAIL PROTECTED] I had to create a
> user who is k5di. No problem doing this. As root use adduser and
> follow the prompts. Under "smtp-server" put that in if you need it.
> 
You don't actually have to create a user.  You can get sendmail to rewrite
the outgoing mail address for you (although sendmail config is
non-trivial).

>       Pine has many configuration possibilities and the most useful
> are the ability to have multiple message areas. And using other
> software called "Procmail" The next section tells you how to set up
> these software.
> 
>       This section deals with sorting mail in to folders. It will
> also cover setting pine up so you have a personal folder collection
> area. Pine doesn't sort mail by itself, instead relying on Procmail
> and it's configuration file .procmailrc to do it for you. This is a
> good thing, and you can define many message areas in .procmailrc and
> read them with Pine.
> 
>       First, let make sure that pine is ready to read these
> folders. Start Pine and your in the main menu. If you reading this in
> pine pressing 'm' after you are done will bring you to the main menu.
> Now you will need to press 's' then 'c' to get to the configuration
> menu. Look for this line: 'incoming-archive-folders'. It is on the
> first screen. Change it to read something like
> incoming-archive-folders = mail/folders[] Note: mail is a directory,
> use just for folders. You should make sure it exists. Don't use this
> directory for anything else except mail.
> 
>       Now we, going to look for this field: [ ]
> enable-incoming-folders. Press 'w' and type "enable-inc" press enter
> and you will be at the right place. Now press enter and then X. Now
> it should look like:
> 
>         [X]  enable-incoming-folders
> 
> Now press 'e' and 'y' and your back in the Main Menu and done with
> configuring Pine.
> 
> POPING THE MAIL:
> 
>       I have found that "popclient" does not work well and
> "fetchpop" works just great for getting your e-mail. Get fetchpop
> from your linux cd-rom, as I did, or from sunsite.url.edu and compile
> it on your linux computer. Then read the README and the man pages
> that are well written.
> 
Personally I found that fetchmail is more powerful, but for this purpose
fetchpop and fetchmail are pretty much the same.

>       At this time I run Fetchpop from a bash file called
> checkmail. I run it when I want to pop mail to my computer. First of
> course I need to start the ppp system and connect to my ISP. This is
> done by an application on my Xwindow system. So at the xterm window
> for the k5di login I type 'checkmail' and all mail found is put into
> a file I have determined to use. In my case that file is:
> 
>       /home/k5di/mail-stuff/mail-in
> 
> PROCMAIL SETUP:
> 
>       Now it's time to make the file .procmailrc in your root
> directory. My root is /home/k5di. Use your favorite editor for this
> step.

No.  Your root is /, by definition.  /home/k5di is your home directory.

> 
> Make the top 2 lines look exactly like below:
> 
> VERBOSE=off
> SENDMAIL=/usr/sbin/sendmail
> 
>       One thing to remember with procmail is that it doesn't expand
> the ~/ to your home directory. So you must use the proper address for
> your home directory which will be /home/your's.
> 
You can also use $HOME.

>  Now to the sorting part. :) I'm going to give a
> recipe (term used in man procmail) that is in actual use. Then I
> will discuss how it works. 
> 
> ----------------snip------------------
> :0:
>         *^Return-Path:.<[EMAIL PROTECTED]>
>         /home/grycloak/mail/Linux_Newbies
> 
> ----------------end snip--------------
> 
You should really use the "Sender" header rather than the return path
since it is garunteed yo work.  Having said this, Return-Path will
practically always work.

> Now to explain how this works:
> 
> :0:
> 
> The first ':' marks the beginning of a recipe. 
> The '0'is the rule set. (For sorting and kill file it always 0)
> The last ':' tells procmail to use a local lock file.
> 
> There is lots to the above line and you can get far more complex. That
> is beyond the scope of this paper.
>
> Now to the last two. Lines, This is where the real work goes on.
> 
> *^Return-Path:.<[EMAIL PROTECTED]>
> 
> The * marks the the start of a condition. FYI mine are started with a
> tab as the first character on a line. The ^ marks the beginning of a
> line.
> 
> Now for the rest of it. The Return-Path: is a header at the top of
> the email. Pressing 'h' while in an email will show these. I simply
> cut and paste the headers I wanted to put in the .procmailrc file.
> (oh, note the dot before the name. It is important) That dot between
> the ":" and the "<" is used like a wild card. Here is a snippet on
> it from man procmailrc:
> 
> ".         Any character except a newline"
> 
You really want a .* in there instead of just a . since . will match
precisely one character.  .* matches anything (* = any number of the
previous character)

>       The second line is where we want to put the email. (If the
> folder doesn't exist procmail will create it. If it does, procmail
> will append files to it) Here is the line.  
> 
>         /home/grycloak/mail/Linux_Newbies
> ^                      ^
> |_ tab                 |_ path and filename
> 
> To kill files you would put /dev/null as path.
> 
> I recommend reading man procmailrc and man procmail for further
> reading. There is a lot of power in procmail that blows you away.
> Here are two more ways to kill file and a fancy sort. The procmail
> recipes are actual work recipes on my system.
> 
> :0:
>         *^Return-Path:.*owner-alert.*
>         /home/grycloak/mail/ISS_Security_Alert
>  
> :0:
>         *^Return-Path:.*<[EMAIL PROTECTED]>
>         /dev/null
>  
> 
> 
>       One extra note, a blank line must exist between recipes and '#'
> are treated as comments.
> 
>       As another example of a .procmail file is shown below. It is
> working now on this system:
> 
> VERBOSE=off
> SENDMAIL=/usr/sbin/sendmail
> 
> :0:
>       *^To:.*[EMAIL PROTECTED]*
>       /home/k5di/mail/My-Mail
> 
If this is k5di's procmailrc, then the "/home/k5di/mail/" is not needed -
procmail will add it automatically.

<snip>

>       A final file needs to be made that starts procmail. This is
> done wirh a bash script that you can copy.
> 
> ----------------------------------
> #!/bin/sh
> 
>               ORGMAIL=/home/k5di/mail-stuff/mail-in
> 
>               if cd $HOME &&
>                test -s $ORGMAIL &&
>                lockfile -r0 -l3600 .newmail.lock 2>/dev/null
>               then
>                 trap "rm -f .newmail.lock" 1 2 3 15
>                 umask 077
>                 lockfile -l3600 -ml
>                 cat $ORGMAIL >>.newmail &&
>                  cat /dev/null >$ORGMAIL
>                 lockfile -mu
>                 formail -s procmail <.newmail &&
>                  rm -f .newmail
>                 rm -f .newmail.lock
>               fi
>               exit 0
> ---------------------------------
> 
> This file you make exicutable with chmod 755 filename. I call this
> bash script with my other one that calls fetchpop. Or you can just
> add the fetchpop line at the top of this file. Change ORGMAIL= to be
> the file fetchpop puts the unsorted mail into.
> 
>
This will work, but you could simply read the procmail man page, and
create a .forward file containing:
   "|IFS=' '&&exec /usr/local/bin/procmail -f-||exit 75 #YOUR_USERNAME"

in which case sendmail will run procmail automagically whenever you get an
email.  Alternatively, set up sendmail to use procmail as your local
delivery agent (RedHat does this I think).

--
Mike <[EMAIL PROTECTED]>

I'll meet you... on the dark side of the moon...
                -- Pink Floyd

Reply via email to