[Dovecot] [Solved] How to make dovecot-lda/deliver mark a message as seen

Stefan Piegsa s at s7p.de
Wed Aug 10 23:19:30 EEST 2011


On 08/09/2011 05:48 PM, Stefan Piegsa wrote:
> 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".
>

I solved the problem now as follows:
With MODIFY_REPLACE instead of MODIFY_ADD my original approach seems to 
work.
I added an -S switch to the dovecot-lda sources and when it is set, I do
mail_update_flags(ctx.src_mail, MODIFY_REPLACE, MAIL_SEEN)
just before mail_deliver(...)

A solution without modifing dovecot's source would be more pleasant but 
I don't see an option to match the destination mailbox with sieve or any 
other way to set the seen flag upon mail delivery.

Best Regards,
Stefan






More information about the dovecot mailing list