procmail
[Top] [All Lists]

Re: .forward switched of by sysadmin: How to use procmail?

2000-01-14 04:23:16
On Thu, Jan 13, 2000 at 10:39:03PM -0600, Philip Guenther wrote:
Thomas Ziegler <zie(_at_)iis(_dot_)fhg(_dot_)de> writes:
...
I've been using this script for quite a while now until I had to realize
that apparently mails are disappearing. My .procmailrc is very simple:

#
# The litte brothers database extracts email addresses and
# stores it in ~/mail/
#
:0hc
| /home/zie/bin/linux/lbdb-fetchaddr
                                   
:0:
* ^TO(_dot_)*procmail(_at_)*
$HOME/mail/procmail

This almost certainly doesn't mean or do what you think it does.  The ".*"
after the "^TO" is likely to be unneeded (the ^TO expansion includes
something similar) and "@*" tells procmail to match zero or more at-signs.
You probably want to instead write:
      :0:
      * ^TOprocmail@
      $HOME/mail/procmail

Ditto for the other recipes with "^TO.*" and "@*".


...
:0
* ^From.*zie
* ^Subject:.*test
{
:0
$HOME/mail/zie.test
}

Unless you have a recipe immeadiately after this with the 'A', 'a',
'e', or 'E' flags, the above is equivalent to:

      :0
      * ^From.*zie
      * ^Subject:.*test
      $HOME/mail/zie.test

Yes, that's right. I already got some hints concerning the bad style of my
recipes. I'll change them.


As it does not contain any DEFAULT-variable, procmail reads from the
standard system mailbox and writes the result back to it again. The docu
says, that procmail locks the system mailbox before doing any operation on
it. If sendmail is already writing to the system mailbox -- e.g. after
receiving a new message --, procmail should detect that as well and delay
the write process.

Seems doubtful.  I would suggest that you specify a logfile at the top
of you .procmailrc and if that doesn't show anything after a while,
try putting VERBOSE=on up at the top also.

BTW: how do you know that messages are being lost?  Have you checked the
logs generated by your MTA (probably sendmail)?

Philip,

thanky for your response. Here at my office, I'm only user, so I do not have
personal access to the sendmail logfiles.

But after one of our customers was complaining about me not answering to his
mails, I started checking. On the phone, our sysadmin confirmed, that the
customers mail had been received by the mail relay and had been transmitted
to our local mailhub here in the office. The mail folder is exported from
the mailhub and mounted at the appropriate place on all unix machines.

Later I realized that mails, sent by colleagues did not arrive me (I saw
their outgoing copies). After I was the only guy, who lost mail, it seems
that it's the procmail based filter (BTW: procmail v3.11pre7 1997/04/28).

Because of these errors, I'm a little bit afraid to setup the same filter, 
only with logging enabled. I need to know, if it's possible that

- procmail accidentally can overwrite incoming mail, if it is started by
  cron, reads from the system folder and writes unfiltered mails back to
  system folder again?

- there is an interaction of procmail with my mailer (mutt), which is also
  working on the system folder?
  
Further hints?

Thomas


-- 
Dr.-Ing Thomas Ziegler          Phone +49 9131 776-348
FhG-IIS A, Audio/Multimedia     FAX   +49 9131 776-398
Am Weichselgarten 3
D-91058 Erlangen