Sieve body test

@lbutlr kremels at kreme.com
Tue Oct 20 22:46:16 EEST 2020


I have an email where I need to edit the body. I know this is generally a bad idea, but in this case I need to do it. The email comes in automatically every week or two, and so I thought that SIEVE would be the way to go.

if header :contains "from" "theaddress at tehdomain" {
        if body :raw :contains "A string" {
	  # Magic happens here
        }
}

It looks like what I need to do is enable and use vnd.dovecot.filter to pipe the message to a script. (Er. | not vnd.dovecot.pipe)

So, if I wanted to transform the message so that the string "foobar13" was changed to "foo-bar-13"

I would add 

       filter :try "myfoobarfix.sh" 

After "magic happens here">

OK so far?

Now, what are the requirements on the executable script? Would it literally be as simple as an executable file that simply said

sed -e '|foobar13|foo-bar-13|g'

Or does it need to be a shebang script and take input on $1 and … ? 

And lastly, where do the executable scripts need to be? https://raw.githubusercontent.com/dovecot/pigeonhole/master/doc/rfc/spec-bosch-sieve-extprograms.txt says "the external programs cannot be chosen arbitrarily; the available programs are restricted through administrator configuration", but no details on exactly how that is configured.


-- 
"Are you pondering what I'm pondering?"
Pinky: I think so, Brain. But if I put on two tutu's, would I really
	be wearing a four-by-four?
Brain: Why do I even bother asking?
Pinky: I dunno, Brain. Maybe it's all part of some huge, cosmic
	plot formula!



More information about the dovecot mailing list