M. Koehler
2016-May-19 12:40 UTC
sieve-extprogram: How to hand over a variable or pipe a mail so a shell script?
Hi, I?m just playing around with sieve-extprogram but it didn?t works like I think. I want a. execute a shell script that get the subject as parameter my try: require ["fileinto","variables","envelope","vnd.dovecot.execute"]; if header :contains "Subject" "123test" { execute :input "${1}" "exec-test"; keep; } and require ["fileinto","variables","envelope","vnd.dovecot.execute"]; if header :contains "Subject" "123test" { execute "exec-test" "${1}"; keep; } The shell script will create a file with $1 as text. But I didn?t get any output - the created file is empty b. later the complete mail should piped to the shell script require ["fileinto","variables","envelope","vnd.dovecot.execute"]; if header :contains "Subject" "123test" { execute :pipe "exec-test"; keep; } This should (as http://hg.rename-it.nl/dovecot-2.2-pigeonhole/raw-file/tip/doc/rfc/spec-bosch-sieve-extprograms.txt described) hand over the complete mail to the script But I don?t know how I handle the complete mail with a shell script? I think the mail will not hand over as a parameter to the shell script, right? But how should I store the mail into a file or should I pipe it through a sed command line (and so one) into a shell script? Hope someone could bring some lights into my darkness :) Best regards, Michael
M. Koehler
2016-Jun-16 07:41 UTC
sieve-extprograms: How to hand over a variable or pipe a mail so a shell script?
Hi, did nobody has any suggestions?! I?m still stucking :(. Best regards, Michael> I?m just playing around with sieve-extprograms but it didn?t works > like I think. I want > > a. execute a shell script that get the subject as parameter > > my try: > > require ["fileinto","variables","envelope","vnd.dovecot.execute"]; > if header :contains "Subject" "123test" > { > execute :input "${1}" "exec-test"; > keep; > } > > and > > require ["fileinto","variables","envelope","vnd.dovecot.execute"]; > if header :contains "Subject" "123test" > { > execute "exec-test" "${1}"; > keep; > } > > The shell script will create a file with $1 as text. But I didn?t get > any output - the created file is empty > > b. later the complete mail should piped to the shell script > > require ["fileinto","variables","envelope","vnd.dovecot.execute"]; > if header :contains "Subject" "123test" > { > execute :pipe "exec-test"; > keep; > } > > This should (as > http://hg.rename-it.nl/dovecot-2.2-pigeonhole/raw-file/tip/doc/rfc/spec-bosch-sieve-extprograms.txt > described) hand over the complete mail to the script But I don?t know > how I handle the complete mail with a shell script? I think the mail > will not hand over as a parameter to the shell script, right? But how > should I store the mail into a file or should I pipe it through a sed > command line (and so one) into a shell script?
Stephan Bosch
2016-Jun-16 21:46 UTC
sieve-extprogram: How to hand over a variable or pipe a mail so a shell script?
Op 5/19/2016 om 2:40 PM schreef M. Koehler:> Hi, > > I?m just playing around with sieve-extprogram but it didn?t works like > I think. I want > > a. execute a shell script that get the subject as parameter > > my try: > > require ["fileinto","variables","envelope","vnd.dovecot.execute"]; > if header :contains "Subject" "123test" > { > execute :input "${1}" "exec-test"; > keep; > } > > and > > require ["fileinto","variables","envelope","vnd.dovecot.execute"]; > if header :contains "Subject" "123test" > { > execute "exec-test" "${1}"; > keep; > } > > The shell script will create a file with $1 as text. But I didn?t get > any output - the created file is emptyWhat is ${1} supposed to contain? Only with the ":matches" and ":regex" match types those numeric variables are assigned.> b. later the complete mail should piped to the shell script > > require ["fileinto","variables","envelope","vnd.dovecot.execute"]; > if header :contains "Subject" "123test" > { > execute :pipe "exec-test"; > keep; > } > > This should (as > http://hg.rename-it.nl/dovecot-2.2-pigeonhole/raw-file/tip/doc/rfc/spec-bosch-sieve-extprograms.txt > described) hand over the complete mail to the script But I don?t know > how I handle the complete mail with a shell script? I think the mail > will not hand over as a parameter to the shell script, right? But how > should I store the mail into a file or should I pipe it through a sed > command line (and so one) into a shell script? > > Hope someone could bring some lights into my darkness :)The mail is passed as the standard input of the script. Lots of online resources should tell you what that means. Regards, Stephan.