procmail
[Top] [All Lists]

Re: Can procmail be use to forward contents of an INBOX?

1997-03-31 12:32:07
On Mon, 31 Mar 1997 10:25:18 -0800,
"Simeon ben Nevel" <Simeon(_dot_)Nevel(_at_)Schwab(_dot_)COM> wrote:
Is there a what to get procmail to process the contents of my in-box 
(which is /var/spool/mail/$LOGNAME) and forward the messages individually 
to a specified address?

Search for "postprocess" in the NOTES section of the main Procmail
manual page; the example script there should do what you want.

You might want to check that lockfile -ml does what it's supposed to
do, I had problems with that on my home system.
  (I.e. after you say lockfile -ml, send yourself a mail and see if it
gets delivered. It should +not+ be delivered until you unlock the
spool again with lockfile -mu. If it looks like it's working, it is of
course a bit hard to test conclusively, but if mail +is+ delivered
while you [think you] are locking your spool file, you know you are in
trouble.)
  (Also note that the example script thinks you use /usr/spool/mail;
change that to /var/spool/mail.)

At work I have the following:

Now we know how to fiddle with your mail. Maybe you want to include
some safety measures? ;^)

:0
? test -f $HOME/.sendmailhome
! snevel(_at_)my(_dot_)isp(_dot_)com

I *do* realize that I should have some mail-loop detection here, but I'm 
unsure how to insert the X-Loop: header as part of the last recipe.  I do 
know how to test for it.

:0
* ? test -f $HOME/.sendmailhome
* ! ^X-Loop: My sendmailhome X-loop
| formail -A "X-Loop: My sendmailhome X-loop" | $SENDMAIL -oi 
snevel(_at_)my(_dot_)isp(_dot_)com

SENDMAIL needs to be set to the location of your Sendmail, could be
/usr/sbin/sendmail or /usr/lib/sendmail or some other surprising place.

Hope this helps,

/* era */

-- 
Defin-i-t-e-ly. Sep-a-r-a-te. Gram-m-a-r.  <http://www.iki.fi/~era/>
 * Enjoy receiving spam? Register at <http://www.iki.fi/~era/spam.html>

<Prev in Thread] Current Thread [Next in Thread>