Stephan Bosch stephan@rename-it.nl writes:
Op 5/11/2016 om 8:34 PM schreef Jon Kristensen:
Steffen Kaiser skdovecot@smail.inf.fh-brs.de writes:
On Tue, 10 May 2016, Jon Kristensen wrote:
Which Pigeonhole Sieve extension should I use to process/test a message depending on whether the message is in a particular mailbox? (Is it the mboxmetadata extension by any chance? If so, I would appreciate if someone could tell me what the reason is for it not being enabled by default.)
The reason I want to perform this test is that I have configured my MTA to deliver "outgoing" e-mails to my "Sent" IMAP folder, and these messages arrive unread. I would like to mark them as read using Sieve.
er, I guess, "message is in a particular mailbox" is meaning it to be spooled, or something like that, right?
Do you use subaddressing (aka +addressing, +detail addressing)? Then look here: http://wiki2.dovecot.org/Pigeonhole/Sieve/Examples#Plus_Addressed_mail_filte...
If you want to resolve the question in the second paragraphe, search the mailing list archive about how to get the name of the mailbox, the implicit keep stores the message in. I'm pretty sure, that there was such question lately.
If you actually want to resolve the question in the first paragraphe, to check whether or not the same message has been spooled in a folder already (aka duplicate check), check out the duplicate extension with ":handle" argument. But you probably need to know the target mailbox, too.
I apologize for not expressing my problem in clear enough terms.
My e-mail server will put sent e-mail to the ~/.Maildir/.Sent (which is also a Maildir directory); naturally, the e-mail is first written into ~/.Maildir/.Sent/tmp, and then it's moved to ~/.Maildir/.Sent/new.
After this has happened, I would like Dovecot to run a Sieve program that will discover that the e-mail is in the "Sent" folder, and mark it as seen.
To explain what I'm imagining with code:
if folder :is "Sent" { setflag "\\Seen"; }
So I don't use subaddressing. I always know the target mailbox, but it's always "Sent" (this is configured in the MTA).
I guess knowing the name of the mailbox that implicit keep stores the message in would solve my problem.
I'm assuming you are referring to this:
https://raw.githubusercontent.com/dovecot/pigeonhole/master/doc/rfc/spec-bos...
And in particular this:
"vnd.dovecot.default-mailbox" The default mailbox that is used by the (implicit) keep action. Normally, this will always yield "INBOX", unless this is changed in the configuration.
It says that this normally will yield "INBOX". Do you, given my explanation above, think that it would yield "Sent" in my case? If not, how would I be able to use this?
Your explanation suggests the MTA is directly delivering messages to the Sent folder. In that case Sieve is never involved. Sieve is run only at delivery when said delivery is performed using Dovecot's LDA or LMTP agents.
If you're using dovecot-lda, the target (default) mailbox can be specified using the -m option. LMTP is less flexible and can only use what's after the
recipient_delimiter' in the local part of the address as target mailbox when
lmtp_save_to_detail_mailbox=yes'.Sieve will be able to see the configured default mailbox in the environment extension you mentioned above. You can define an administrator script for marking messages as seen using the sieve_before setting. This script can also prevent the normal user script from being executed by canceling the implicit keep.
Regards,
Stephan.
Thanks for your clarifications!
Just to confirm: Since my MTA is delivering my messages to ~/Mailbox/.Sent directly, neither Sieve or Dovecot's LDA or LMTP facilities can/will be involved, and I can't really solve my original problem (having messages in the Sent folder being marked automatically as read, on the server) using any of these utilities? Or can perhaps dovecot-lda/lmtp be used to process these "Sent" messages?
Any suggestions on elegant approaches that would solve that particular problem would be very welcome.
-- Jon Kristensen (jonkri) PGP fingerprint: 0377 F488 8908 0237 A2AE C484 387E C31D DA60 1350