From owner-freebsd-questions Sat May 3 12:37:47 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id MAA11480 for questions-outgoing; Sat, 3 May 1997 12:37:47 -0700 (PDT) Received: from foo.primenet.com (ip208.sjc.primenet.com [206.165.96.208]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id MAA11475 for ; Sat, 3 May 1997 12:37:42 -0700 (PDT) Received: from localhost (bkogawa@localhost) by foo.primenet.com (8.8.2/8.6.12) with SMTP id MAA20299 for ; Sat, 3 May 1997 12:39:21 -0700 (PDT) X-Authentication-Warning: foo.primenet.com: bkogawa owned process doing -bs X-Received: (from bkogawa@localhost) by foo.primenet.com (8.8.2/8.6.12) id MAA20288; Sat, 3 May 1997 12:37:53 -0700 (PDT) To: bkogawa@foo.primenet.com Path: foo.primenet.com!bkogawa Date: 3 May 97 19:15:39 GMT Message-ID: Newsgroups: localhost.freebsd.questions Subject: Re: procmail question References: From: "Bryan K. Ogawa" X-Newsreader: NN version 6.5.0 #1 (NOV) ReSent-Date: Sat, 3 May 1997 12:39:14 -0700 (PDT) ReSent-From: "Bryan K. Ogawa" ReSent-To: questions@freebsd.org ReSent-Message-ID: Sender: owner-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Annelise Anderson 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