Hi Joel, thanks for your response, you solved my problem. But I still don't
understand why ! :)

with :
$ cat ~/.procmailrc
LOGFILE=procmail.log
VERBOSE=yes
:0
* ^Message-ID: \/.*
| ./curl_molene.sh $MATCH

$ cat ~/curl_molene.sh
#!/bin/bash
/usr/bin/curl "http://url/alerte.php?messageid=$1";

it works as expected. but with :
$ cat ~/.procmailrc
LOGFILE=procmail.log
VERBOSE=yes
:0
* ^Message-ID: \/.*
| /usr/bin/curl "http://url/alerte.php?messageid=$MATCH";


it does not work. Any idea why ?
Regards

Le mer. 21 juin 2023 à 13:35, Joel Roth <jo...@pobox.com> a écrit :

> On Tue, Jun 20, 2023 at 07:52:24AM +0200, BASSAGET Cédric wrote:
> > Hello
> > I'm using fetchamil / procmail to fetch mails from an POP server and
> parse
> > it then launch a script or system call :
> >
> >
> > # cat .fetchmailrc
> > set logfile fetchmail.log
> > poll imaps.dom.tld proto POP3
> > user "u...@dom.tld" pass "xxxxxx" preconnect "date >> ~/fetchmail.log"
> > ssl
> > fetchall
> > keep
> > no rewrite
> > mda "/usr/bin/procmail ~/.procmailrc";
> >
> > # cat .procmailrc
> > LOGFILE=procmail.log
> > VERBOSE=yes
> > :0
> > * ^Message-ID: \/.*
> > #| /usr/bin/curl http://mail.dom.tld/script.php?messageid=$MATCH
> > | echo "whoami" > test.txt
> >
> >
> > This work fine when calling fetchamil as root with "fetchamil -f
> > .fetchmailrc". But when calling fetchmail from a dedicated user, the
> > external script in procmail is not called. It's written in the logfile
> that
> > :
> >
> > procmail: [25332] Mon Jun 19 16:20:28 2023
> > procmail: Assigning "MATCH="
> > procmail: Matched "<9088600d-446a-96b4-4043-29ecd0d5a...@dom.tld>"
> > procmail: Match on "^Message-ID: \/.*"
> > procmail: Assigning "LASTFOLDER= echo "whoami" > test.txt"
> >  Subject: test
> >   Folder:  echo "whoami" > test.txt
> >  1824
> > procmail: Executing " echo "whoami" > test.txt"
> >
> > but nothung happens.
> > Am I missing something ?
> > Regards
> > Cédric
>
> Are you sure that procmail is running the command in a shell?
> Could it be trying to execute a program named 'echo'.
> You might try creating a shell script you can call.
>
>
> --
> Joel Roth
>
>

Reply via email to