executing script on mail arrival from sieve
I currently have a basic script to process some mails, it runs from cron every 10 minutes, basically, sieve copies some mails to subfolder on mail arrival, script fetches mails if any from this subfolder then processes these mail, get maybe 1 or 2 or often none but cron runs the script every 10 minutes, most times not needed as nothing is retrieved it's pretty crude - but works
getmail fetches mails to local folder, deletes in subfolder munpack mailfile to unMIME links dumps HTML to txt
looking at wiki2, 'Pigeonhole Sieve Extprograms Plugin', is this what would allow to execute my script on new mail arrival?
I can't quite figure out how to.. if anyone has any sample, I might try to adapt to my need.. thanks (probably I should just leave like it is till I understand the docs...)
thanks, V
On 11 Jun 2020, at 05:24, Voytek Eymont voytek@sbt.net.au wrote:
looking at wiki2, 'Pigeonhole Sieve Extprograms Plugin', is this what would allow to execute my script on new mail arrival?
Yes.
This is what I have to auto=mark spam when it is moved too the Spam folder and to mark messages as seen when they are archived:
plugin { sieve_plugins = sieve_imapsieve sieve_extprograms #sieve_global = /usr/lib/dovecot/sieve/global/ sieve_default = /usr/lib/dovecot/sieve/default.sieve sieve_default_name = spamassassin
sieve_duplicate_default_period = 1h sieve_duplicate_max_period = 12d
# From elsewhere to Spam folder imapsieve_mailbox1_name = Junk imapsieve_mailbox1_causes = COPY imapsieve_mailbox1_before = file:/usr/lib/dovecot/sieve/report-spam.sieve
# From Spam folder to elsewhere imapsieve_mailbox2_name = * imapsieve_mailbox2_from = Junk imapsieve_mailbox2_causes = COPY imapsieve_mailbox2_before = file:/usr/lib/dovecot/sieve/report-ham.sieve
sieve_pipe_bin_dir = /usr/lib/dovecot/sieve
sieve_global_extensions = +vnd.dovecot.pipe +vnd.dovecot.environment sieve_extensions = +editheader
sieve = file:~/.sieve;active=~/.active_sieve sieve_user_log = ~/sieve.log
imapsieve_mailbox3_name = Archive imapsieve_mailbox3_causes = COPY imapsieve_mailbox3_before = file:/usr/lib/dovecot/sieve/mark-read.sieve
}
# cat /usr/lib/dovecot/sieve/report-spam.sieve [11:51] [/etc/dovecot] require ["vnd.dovecot.pipe", "copy", "imapsieve", "environment", "variables"];
if environment :matches "imap.user" "*" { set "username" "${1}"; }
pipe :copy "sa-learn-spam.sh" [ "${username}" ];
"sa-learn-spam.sh" is the name of the script:
# cat /usr/lib/dovecot/sieve/sa-learn-spam.sh #!/bin/sh exec /usr/local/bin/sa-learn -u ${1} --spam
# cat /usr/lib/dovecot/sieve/mark-read.sieve require ["imap4flags"]; setflag "\\seen";
-- If you write the word "monkey" a million times, do you start to think you're Shakespeare? -- Steven Wright
On Fri, June 12, 2020 3:53 am, @lbutlr wrote:
On 11 Jun 2020, at 05:24, Voytek Eymont voytek@sbt.net.au wrote:
looking at wiki2, 'Pigeonhole Sieve Extprograms Plugin', is this what would allow to execute my script on new mail arrival?
Yes.
This is what I have to auto=mark spam when it is moved too the Spam folder and to mark messages as seen when they are archived:
thanks very much for sharing this, much appreciated! I'll try to follow through and, see how I manage
V
participants (2)
-
@lbutlr
-
Voytek Eymont