*BSD News Article 81602


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!news.Hawaii.Edu!news.uoregon.edu!hammer.uoregon.edu!news-peer.gsl.net!news.gsl.net!howland.erols.net!newsfeed.internetmci.com!uuneo.neosoft.com!not-for-mail
From: conrads@neosoft.com (Conrad Sabatier)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: .forward file format
Date: 26 Oct 1996 22:10:11 GMT
Organization: What?  Me, organize?
Lines: 105
Message-ID: <54u283$729@uuneo.neosoft.com>
References: <54olal$h5u@uuneo.neosoft.com> <54rote$bsc@nntp.Stanford.EDU> <54s8l5$bqs@uuneo.neosoft.com> <54tmud$k8g@nntp.Stanford.EDU>
Reply-To: conrads@neosoft.com (Conrad Sabatier)
NNTP-Posting-Host: 206.27.165.170

In article <54tmud$k8g@nntp.Stanford.EDU>,
Annelise Anderson <andrsn@andrsn.stanford.edu> wrote:
>Conrad Sabatier (conrads@neosoft.com) wrote:
>: In article <54rote$bsc@nntp.Stanford.EDU>,
>: Annelise Anderson <andrsn@andrsn.stanford.edu> wrote:
>: >Annelise Anderson (andrsn@andrsn.stanford.edu) wrote:
>: >: Conrad Sabatier (conrads@neosoft.com) wrote:
>: >
>: >: : Could it be because I'm using popclient to retrieve my mail from my ISP's 
>: >: : POP3 server?
>: >
>: >: Yes, I think so.  I get some mail from a POP3 server and it goes 
>: >: directly into a mail box and never gets processed by procmail.
>: >: Other mail comes to the queue, and when I process the queue the mail
>: >: is then dealt with by the .forward file; my has
>: >
>: >: "|IFS=' '&&p=/usr/local/bin/procmail&&test -f $p&&exec $p -Yf-||exit 75 #andrsn"
>: >
>: >: which looks pretty much like yours.
>: >
>: >: However, I think you can tell the popserver to put the mail wherever you
>: >: want it--you might want to try telling it to put it in /var/spool/mqueue.
>: >
>: >This won't work--but the man page for procmail says that it will process
>: >an already filled (the key word to search for) mailbox.  There's a
>: >script for doing so that assumes the mail is put in /var/mail/username.
>: >So if you run popclient and then the script (extract it from the man
>: >page) it will process the mail in accordance with your .procmailrc.
>
>: Yes...but...*how*???
>
>: My shell programming skills leave much to be desired.  As I said, running
>: procmail manually (the script from man procmail mentioned above) on an
>: already-loaded /var/mail/$LOGNAME mailbox works beautifully.
>
>: OK, so popclient stuffs everything into the /var/mail/$LOGNAME inbox, and
>: then I need to run procmail (the script) on it.  
>
>: So how can I automate this process?
>
>: Or can I pipe popclient's output to sendmail/procmail?
>
>: Help?  Please?
>
>: I *really* need to get this thing working!  The junk mail these days is
>: driving me nuts!
>
>: Many thanks!
>
>Okay, Conrad, try this:
>
>1) do man procmail > procmail.txt (in your home directory)
>2) open procmail.txt with vi and use :se nu to get line numbers.
>Search for filled with /filled to find the script.  Export it to
>a file with :780,800w procscript, where the numbers 780 and 800 are
>the line numbers where the script occurs.  chmod 700 procscript
>so that procscript is executable.  Open procscript with a text
>editor and get rid of the white space on any lines farthest to
>the left.
>3) run popclient with a line something like
>popclient -u conrads -p yourpassword -o /var/mail/conrads your/pop/server
>4) then run procscript (just type procscript or sh procscript)
>If I were doing it I'd make a copy of /var/mail/username first, copy
>the contents of another mailbox there, and test it to make sure it
>did what I expected.
>5) when you're sure this is running create a file, say conmail,
>that has two lines: first the popclient line, then just a line with
>the word procscript; actually it should have three lines, the first
>#!/bin/sh so it knows it's a script.
>6) run conmail when you want to get yourmail
>7) when this is working put the conmail line in your .login file
>8) if you want it to run--both popclient and procscript, which can
>now be called with the conmail script--frequently and automatically,
>you can either add it to /etc/crontab or create a user crontab with
>the crontab command.  These two crontab files have different formats
>(the user crontab has no column for who runs the script; other than
>that they're alike) and live in different places.  See crontab(5)
>and crontab(8).  The line you want in there, along with the stuff
>on how often to run it, is /usr/home/conrads/conmail.  Back up
>/etc/crontab before editing it (this is the easier way to do this).
>You might need a file called allow in the directory with the user
>crontab if you choose that route; see the man pages for what needs to
>be in it.  This is what you'd want to do if you have more than one
>user on the machine.
>9) Keep in mind that while I've run the script we're calling
>procscript here, I haven't actually done the rest of it so this
>comes without warranty!

Just goes to show you, the old adage is true: great minds think alike.
:-)

I *was* looking for a complicated/arcane way of doing this, until it
finally occurred to me just to add a line to invoke the procmail script
in my cron job that invokes popclient.

I haven't tested it out yet, but it seems that this should be the ticket.

Hallelujah!  :-)

Many thanks to all who responded, by the way.  Mucho appreciated!
-- 
Conrad Sabatier                  | 
conrads@neosoft.com              |  Eschew obfuscation.
http://www.neosoft.com/~conrads  |