procmail
[Top] [All Lists]

Piping mail to perl via procmail

1997-04-28 16:57:00
Hello again,

I wish to pipe certain mails to a perl script of my own design. I am
using the following recipe to divert my test messages:

# Pipe test
:0
* ^Subject.* pipetest
| mymail

'mymail' looks like this:

#!/usr/bin/perl
read(STDIN, $buffer, 655350);
open (MOUT, ">mymail.out");
print MOUT $buffer;
close (MOUT);

I just want to capture the mail to a text file first; more processing
will be added later when I can get 'mymail' to accept the piped data. 

'mymail' is executable, the path to perl is correct. 'mymail.out' is
writable by all. I am using the bash shell under unix System V Release
4.0. I am using procmail v3.10. 

If I perform:

cat junk.txt | mymail

then mymail accepts the contents of junk.txt and writes it into
'mymail.out'. So 'mymail' accepts piped data OK.

When I use the above procmail recipe to pipe mail to 'mymail', I get
this in the log:

---[begin log]--------------------------------------------------
mymail: syntax error at line 2: `read' unexpected
procmail: Program failure (2) of "mymail"

From revjack(_at_)saltmine(_dot_)radix(_dot_)net  Mon Apr 28 19:06:14 1997
 Subject: pipetest
  Folder: /usr/mail/revjack                                     877
---[end log]--------------------------------------------------


So my question is, is there anything special I need to do in the
procmail recipe to properly pipe mail to this (or any) perl script?

Thank you,
_________________
revjack(_at_)radix(_dot_)net

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