Gustav Schaffter wrote:
> I start to realize that I need to run fetchmail to get the mail from the
> external POP server. I let fetchmail give the mail to procmail. Then
> what?

Procmail delivers to the local mailspool or to mailbox files in the user's
home directory if filters are used in ~./procmailrc. The filters should put
the mail into the directory used by the preferred mail client, or the mail
client should be configured to read messages in the ~/mail directory. You
can do either of these with Netscape.

Setting up the ~./procmailrc depends on the mail clients that will be used.
If the mail client will be able to read mail stored in files in ~/mail, then
you can setup filters in ~/.procmailrc. Non-filtered messages will be
delivered to the system mailspool. The mailspool can be read directly by
some clients (pine, elm) and by POP3 daemons for delivery to other clients
(Netscape).

I run fetchmail with a root crontab. Each user's ~/.fetchmailrc looks like
this:

defaults protocol pop3 mda "/usr/bin/procmail -d LocalUsername" fetchall
nokeep
poll pop3.isp1.com username RemoteUsername password RemotePassword
poll pop3.isp2.net username RemoteUsername password RemotePassword

Note that I invoke procmail directly istead of delivering to sendmail and
letting sendmail invoke procmail. This bypasses alias processing, but I
don't have any externally visible aliases on this system, so that's not a
problem.

The bash shell script that runs fetchmail includes this:

# Get the mail for each listed user.
for mailuser in user1 user2 user3
do
        /usr/bin/logger -i -t $0 "Retrieving mail for $mailuser"
        /bin/su -l $mailuser -c /usr/bin/fetchmail
done


Instead of listing the users, I could have done this:

# Get the mail for all users.
for mailuser in `ls /home`
do
  if [ -f /home/$mailuser/.fetchmailrc ] ; then
    /usr/bin/logger -i -t $0 "Retrieving mail for $mailuser"
    /bin/su -l $mailuser -c /usr/bin/fetchmail
  fi
done

But not all my uses are on the same retrieval schedule, so I list the users
instead of having the script read /home.

-- 
 Anthony E. Greene <[EMAIL PROTECTED]>
 Homepage & PGP Key <http://www.pobox.com/~agreene/>
 If it's too good to be true, it's probably Linux.


-- 
To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
as the Subject.

Reply via email to