Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Sep 1996 15:19:38 -0700 (PDT)
From:      "Bryan K. Ogawa" <bkogawa@primenet.com>
To:        Anil John <ajohn@cyberforge.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Popclient--FreeBSD--FWTK
Message-ID:  <Pine.BSI.3.94.960922143128.16900A-100000@foo.netvoyage.net>
In-Reply-To: <199609221837.OAA26999@onramp.i95.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 22 Sep 1996, Anil John wrote:

> On 20 Sep 96 at 21:02, bkogawa@primenet.com wrote:
> 
> > If you do want to pick up mail from three separate accounts using
> > your freebsd box, and then use Pegasus to pick up the mail from
> > the freebsd box, you'll need the following:
[...]

> It works!!!. Thanks Brian..

Cool.

> > Run the script which does pickup every time you want to get your
> > mail (or every time you connect your PPP session).
> 
> > 1.  It's a security risk to leave your pop account passwords
> > sitting in the script on your freebsd machine.  Probably not a
> > glaring one, but still a hole.  You can configure the popclients to
> > take your password from stdin like passwd and su and the like (this
> > is what I do).
> 
> I am not all that familiar scripts, so a couple of questions.. From
> what you descibed above, is it possible to set up a script that runs
> popclient each time pegasus goes to check the mail on my FreeBSD
> box..Or I could live with running popclient periodically on my
> freebsd box..

What I was thinking of was a cron job that checks to see if you have a PPP
connection running on the FreeBSD box, and if there is one, running
popclient.

> > 2.  You may have problems with popclient delivering to
> > /var/mail/<username>, although I don't think so.  I don't think
> > popclient flocks the mailbox it uses, which means if something
> > else tries to deliver at the same time, your mail is probably
> > hosed. Deliver to temporary boxes, then use a program that
> > understands mailbox locks (procmail? formail? a perl script?) to do
> > the delivery from these boxes to avoid this potential catastrophe. 
> 
> Since one of the reasons I am running this setup is to check
> multiple mailboxes, this would be a concern for me...You kind of
> lost me above, Currently 'popclient' delivers mail to
> /usr/mail/ajohn. Is what you are suggesting that I use popclient to
> deliver mail to multiple folders, say one for each account that I
> use popclient with, then use some other program like procmail to get
> the mail from the multiple folders to 'var/mail/ajohn'?

Yes.  procmail should correctly handle mailbox locking (according to the
man page for mine, it uses fcntl). 

However, a simpler solution is probably formail (from the procmail
package) and mail.local (the standard mail delivery program).

The basic idea would be something like this:

#!/bin/sh
popclient -3 -o temp-mailbox-1 -u <username> -p <password> <pop-hostname>
formail -s /usr/libexec/mail.local ajohn < temp-mailbox-1



Remember to substitute <username> <password> and <pop-hostname>
appropriately.  This script can be repeated for each mailbox you're
running, and can also be used to receive email from many mailboxes at the
same time.  Make sure you use different temporary mailbox names for each
separate mailbox you deliver.

If you add some "run only if the connection is up" code, or if you have a
dial on demand or dedicated connection, then you can put this in cron.

An advantageous side effect of using popclient to deliver to a temporary
file is that if procmail or formail suddenly fail, you can keep the raw
POP mailbox around and try delivery again or read it manually using mail
or more or something. 

If you'd like, you can see my "get POP mail" script.  It's designed for
someone reading mail with pine, so it is probably a bit on the complex
side, but it might be helpful to someone else.  It's written in perl.
"Features" include:

1.  Uses a separate folder for its inbox, which contains multiple separate
inboxes (supported by recent versions of pine). 

2.  Manages backup copies of the raw incoming mail.  This is handy when I
mess stuff up (like yesterday, when I changed things so that my mailing
lists got dumped to never-never land).  It helps to ease my mind and keeps
me more willing to experiment.  Additionally, I don't have to remember to
delete the old backups, since the script manages backup rotation, as well.

3.  Pipes the incoming boxes to procmail.  

I hope this helps--I've been fiddling a lot with this stuff of late.

bryan k ogawa  <bkogawa@primenet.com>   http://www.primenet.com/~bkogawa/





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSI.3.94.960922143128.16900A-100000>