Stefan Piegsa
2011-Aug-08 05:47 UTC
[Dovecot] How to make dovecot-lda/deliver mark a message as seen
Hello everybody, I am using dovecot 2.0.13 and have a special case here in which I want a mail that is delivered locally with dovecot-lda to be marked as "seen". In dovecot 1.1.7 I succeeded to achive this, by modifing deliver.c so that upon adding a -S switch to the command arguments, the flag MAIL_SEEN was added to the call of mailbox_copy(). This seemed to work pretty good. With the new version, i tried to do something similar by selectively adding mail_update_flags(ctx.src_mail, MODIFY_ADD, MAIL_SEEN); just before the call of mail_deliver(), whenever the -S argument is given. But this does not work. What is wrong? Is there a better way to set MAIL_SEEN for a locally delivered mail? I would prefer a method that does not require to mess around in the dovecot sources. :-) Thanks in advance & Best Regards, Stefan
Andrzej Adam Filip
2011-Aug-08 06:36 UTC
[Dovecot] How to make dovecot-lda/deliver mark a message as seen
"Stefan Piegsa" <s at s7p.de> wrote:> Hello everybody, > > I am using dovecot 2.0.13 and have a special case here in which I want > a mail that is delivered locally with dovecot-lda to be marked as > "seen". > > In dovecot 1.1.7 I succeeded to achive this, by modifing deliver.c so > that upon adding a -S switch to the command arguments, the flag > MAIL_SEEN was added to the call of mailbox_copy(). This seemed to work > pretty good. > > With the new version, i tried to do something similar by selectively adding > mail_update_flags(ctx.src_mail, MODIFY_ADD, MAIL_SEEN); > just before the call of mail_deliver(), whenever the -S argument is given. > > But this does not work. What is wrong? > > Is there a better way to set MAIL_SEEN for a locally delivered mail? I > would prefer a method that does not require to mess around in the > dovecot sources. :-) > > Thanks in advance & Best Regards, > StefanHave you considered using sieve for the task? [Using imap4flags extension] http://wiki.dovecot.org/LDA/Sieve #v+ if address ["Return-Path"] ["my_address at my_domain.com"] { setflag "\\seen"; } #v- -- [pl>en: Andrew] Andrzej Adam Filip : anfi at onet.eu What if nothing exists and we're all in somebody's dream? Or what's worse, what if only that fat guy in the third row exists? -- Woody Allen, "Without Feathers"
Stefan Piegsa
2011-Aug-09 15:48 UTC
[Dovecot] How to make dovecot-lda/deliver mark a message as seen
On 08/08/2011 11:46 AM, Andrzej Adam Filip wrote:> On 08/08/2011 09:43 AM, Stefan Piegsa wrote: >> Thanks for your reply! >> >> On 08/08/2011 08:36 AM, Andrzej Adam Filip wrote: >>> Have you considered using sieve for the task? >>> [Using imap4flags extension] >> Yes, but I think it's not the optimal solution for what I want to do: >> >> Basically, I don't want emails to be sent first to the MTA and then >> again to dovecot to be stored in "Sent Messages". >> So I made a script that puts an email received from the MTA by an >> authenticated user into his local Maildir/Sent folder, using: >> dovecot-lda -d $user -m Sent. Such emails should be marked as seen. >> >> Sieve would be an option if it were possible to have a global sieve >> script that is always executed, not only when there's no user script. >> >> Best Regards, >> Stefan >> > Could not you use sieve_before? > http://wiki.dovecot.org/LDA/Sieve > > You may consider using sieve_after if you want to allow users to > overwrite your choice of "self copy" handling. >sieve_after sounds interesting! Is there a way to match the destination mailbox in a sieve script? The email comes in by dovecot-lda -d $user -m Sent Now the sieve script should somehow match the mailbox "Sent".