[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: fetchamil / procmail as non root : unable to call script



Hello Tomas,
Same result : log seems fine, but /tmp/test.txt still does not exist :

procmail: Executing " echo "whoami" > /tmp/test.txt"
procmail: Assigning "LASTFOLDER= echo "whoami" > /tmp/test.txt"
 Subject: test
  Folder:  echo "whoami" > /tmp/test.txt                                   1825

Regards

Le mar. 20 juin 2023 à 08:34, <tomas@tuxteam.de> 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 "user@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-29ecd0d5a557@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.

Hm. Long time I didn't play with fetchmail. One suggestion,
though: when this 'echo "whoami"...' is executed, do you
know which directory it is happening in? Try redirecting
to /tmp/test.txt or whatever, just to be sure.

Cheers
--
t

Reply to: