Skip site navigation (1)Skip section navigation (2)
Date:       3 May 97 19:15:39 GMT
From:      "Bryan K. Ogawa" <bkogawa@primenet.com>
To:        bkogawa@foo.primenet.com
Subject:   Re: procmail question
Message-ID:  <bkogawa.862686939@foo.primenet.com>
Resent-Message-ID: <Pine.BSI.3.94.970503123914.20297B@foo.primenet.com>
References:  <Pine.BSI.3.94.970503101523.27498B-100000@andrsn.stanford.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
Annelise Anderson <andrsn@andrsn.stanford.edu> writes:

>I have procmail running just fine; I also have sendmail.cf set so
>the mail stays in a queue until I run the queue.  In addition I
>have popper running to pop mail up from a couple of other machines
>where I get some mail.  

>I would like this mail to go into the queue, not directly into a
>mailbox.  This entry in .procmailrc doesn't work: 

>:0:/tmp/.maillock-other
>* ^To.*hoover
>* ^To.*leland
>/var/spool/mqueue

>Is there a way to do this so it will work?

Hm.  I'm assuming you want to read using popclient and put it into the
mail queue, delivered to a single address.

Try:

If you want all of your pop mail to go into the queue, try:

popclient -c | formail -s sendmail address@to.deliver.to

or something akin to the following, which is much safer--it can even
recover from pilot error (like accidentally deleting an important
message):

-------cut---------
#!/bin/sh

 if [ -f pop.mail.box.2 ] ; then mv -f pop.mail.box.2 pop.mail.box.3 ; fi
 if [ -f pop.mail.box.1 ] ; then mv -f pop.mail.box.1 pop.mail.box.2 ; fi
 if [ -f pop.mail.box.0 ] ; then mv -f pop.mail.box.0 pop.mail.box.1 ; fi
 if [ -f pop.mail.box ] ; then
         cp -pf pop.mail.box pop.mail.box.0
 fi
 popclient -o pop.mail.box
 formail -s sendmail address@to.deliver.to < pop.mail.box

-----cut end-----------

NOTE: I didn't test the above, I just cut and edited from /etc/daily
or the like.  The basic idea is to use popclient to deliver to a file,
then formail the file instead of stdin, and to make backups.  The
former is much less useful without the latter.

2.  If you want to go from procmail into the queue (even though this
could produce loops, which procmail may or may not handle), try:

----cut------------
:0:/tmp/.maillock-other
* ^To.*hoover
* ^To.*leland
|/usr/sbin/sendmail address@to.deliver.to
-----cut end----

#1 appears to work, at least for _local_ deliveries on my machine, but
I haven't tested it extensively.  Please be careful when testing; you
could theoretically try to redeliver every piece of mail you get
through popclient this way, which may endlessly anger any mailing list
which suffers at your hands. :)

#2 should work, but I haven't tested it.  Since I really don't use my
mail queue for anything in the first place (I get my mail through pop
and send it directly to procmail), I don't have a use for it.  On the
other hand, I do the same thing to deliver mail (like mailing lists)
to rpost so that i can read mailing lists in nn and slrn.

Someone else (who I cannot recall at the moment) was asking about how
to use procmail with popclient directly.  The way to do this is to use
one of tthe above formulae, but with procmail substituted for
sendmail, e.g.:

popclient -c | formail -s procmail

  or, the safer:

-------cut---------
#!/bin/sh

if [ -f pop.mail.box.2 ] ; then mv -f pop.mail.box.2 pop.mail.box.3 ; fi
if [ -f pop.mail.box.1 ] ; then mv -f pop.mail.box.1 pop.mail.box.2 ; fi
if [ -f pop.mail..box.0 ] ; then mv -f pop.mail.box.0 pop.mail.box.1 ; fi
if [ -f pop.mail.box ] ; then
        cp -pf pop.mail.box pop.mail.box.0
fi
popclient -o pop.mail.box
formail -s procmail < pop.mail.box

-----cut end-----------

Again, it's untested.

Note that the cp -pf   could be replaced by mv , as far as I can see.

Hope this helps.

My personal usage is to deliver via popclient into a file with 8
backups, similar to above, then use formail to pipe this file into
procmail, which delivers to boxes and to programs (specifically a
wrapper to rpost).

>Thanks

>Annelise




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bkogawa.862686939>