[Dovecot] Change/add mail header via IMAP
Hello.
I create RoundCube plugin and I have question. I want add mail header and I see 2 way:
- change file via filesystem (mailbox in maildir format);
- change header via dovecot.
I think 1) bad way. But I do not know dovecot support change head information or not? My by via IMAP commant? same programm (LDA?)? May be it impossible via dovecot?
On Mon, 2011-04-04 at 15:52 +0400, Алексей Сундуков wrote:
I create RoundCube plugin and I have question. I want add mail header and I see 2 way:
- change file via filesystem (mailbox in maildir format);
- change header via dovecot.
I think 1) bad way. But I do not know dovecot support change head information or not? My by via IMAP commant? same programm (LDA?)? May be it impossible via dovecot?
It's not possible to modify existing messages. If you manually modify mail files in filesystem Dovecot will complain and users' IMAP clients may break. The best you can do is save a new modified message and delete the old one.
May be if save mail in new file it can break index dovecot files, because file name change? Mail is text file, if I add one line (like X-Mozilla-Keys: test) how its can break mail?
2011/4/4 Timo Sirainen tss@iki.fi:
On Mon, 2011-04-04 at 15:52 +0400, Алексей Сундуков wrote:
I create RoundCube plugin and I have question. I want add mail header and I see 2 way:
- change file via filesystem (mailbox in maildir format);
- change header via dovecot.
I think 1) bad way. But I do not know dovecot support change head information or not? My by via IMAP commant? same programm (LDA?)? May be it impossible via dovecot?
It's not possible to modify existing messages. If you manually modify mail files in filesystem Dovecot will complain and users' IMAP clients may break. The best you can do is save a new modified message and delete the old one.
On Mon, 2011-04-04 at 19:40 +0400, Алексей Сундуков wrote:
May be if save mail in new file it can break index dovecot files, because file name change?
If the filename changes, it becomes a new mail. You don't break index files, but clients see it as a new message.
Mail is text file, if I add one line (like X-Mozilla-Keys: test) how its can break mail?
IMAP protocol requires that mails never change. Clients might cache the message's size, and when it suddenly becomes larger they might not download the entire message. Things like that.
Why do you want to modify existing messages anyway?
Some program modify can header. Example LDA. And I thought why not? Why I can't do this?
I use web interface RoundCube and same time Mozilla Thunderbird. In Mozilla Thunderbird I can add tag. But this tag I can't see in RC (now RC no support tag, only favorite, but I can write plugin). Thunderbird save tags in own local database, RC in own. It's two different database. If I set tag via Thunderbird, I don't see this change in RC database. I think it not right. Information about mail should stored in one place. Imho, this place is email header. In this case I can see same tag in all my email clients.
So I'm trying add header in existing messages. Maybe there's another way stored tag in one place and indicate email client use it? Maybe special protocol?
2011/4/4 Timo Sirainen tss@iki.fi:
On Mon, 2011-04-04 at 19:40 +0400, Алексей Сундуков wrote:
May be if save mail in new file it can break index dovecot files, because file name change?
If the filename changes, it becomes a new mail. You don't break index files, but clients see it as a new message.
Mail is text file, if I add one line (like X-Mozilla-Keys: test) how its can break mail?
IMAP protocol requires that mails never change. Clients might cache the message's size, and when it suddenly becomes larger they might not download the entire message. Things like that.
Why do you want to modify existing messages anyway?
On 4.4.2011, at 23.43, Алексей Сундуков wrote:
Some program modify can header. Example LDA. And I thought why not? Why I can't do this?
In LDA it's fine to modify headers, because the message hasn't been saved yet. In Sieve there is an extension to do this, although Pigeonhole doesn't support it yet.
I use web interface RoundCube and same time Mozilla Thunderbird. In Mozilla Thunderbird I can add tag. But this tag I can't see in RC (now RC no support tag, only favorite, but I can write plugin). Thunderbird save tags in own local database, RC in own. It's two different database. If I set tag via Thunderbird, I don't see this change in RC database. I think it not right. Information about mail should stored in one place.
Thunderbird should already be storing tags to Dovecot using $Label1..$Label5 IMAP keywords (= custom flags).
Imho, this place is email header. In this case I can see same tag in all my email clients.
I think email header is the wrong place for this.
So I'm trying add header in existing messages. Maybe there's another way stored tag in one place and indicate email client use it? Maybe special protocol?
IMAP already supports keywords. I think those would work for what you want.
Great thank!
Now I see, I wrong. You right, stored tag in to email header is bad place.
2011/4/5 Timo Sirainen tss@iki.fi:
On 4.4.2011, at 23.43, Алексей Сундуков wrote:
Some program modify can header. Example LDA. And I thought why not? Why I can't do this?
In LDA it's fine to modify headers, because the message hasn't been saved yet. In Sieve there is an extension to do this, although Pigeonhole doesn't support it yet.
I use web interface RoundCube and same time Mozilla Thunderbird. In Mozilla Thunderbird I can add tag. But this tag I can't see in RC (now RC no support tag, only favorite, but I can write plugin). Thunderbird save tags in own local database, RC in own. It's two different database. If I set tag via Thunderbird, I don't see this change in RC database. I think it not right. Information about mail should stored in one place.
Thunderbird should already be storing tags to Dovecot using $Label1..$Label5 IMAP keywords (= custom flags).
Imho, this place is email header. In this case I can see same tag in all my email clients.
I think email header is the wrong place for this.
So I'm trying add header in existing messages. Maybe there's another way stored tag in one place and indicate email client use it? Maybe special protocol?
IMAP already supports keywords. I think those would work for what you want.
W dniu 2011-04-05 10:54, Алексей Сундуков pisze:
Now I see, I wrong. You right, stored tag in to email header is bad place.
Take a look at this Roundcube plugin http://www.roundcubeforum.net/7-third-party-contributions/46-api-based-plugi...
-- Aleksander 'A.L.E.C' Machniak http://alec.pl gg:2275252 LAN Management System Developer http://lms.org.pl Roundcube Webmail Developer http://roundcube.net
Thank!
Interesting plugin. It's support what I want, but do not come to me. List tag write in config file, user can't change it via setting RC page. Can't change colors. I add "Тест" tag via Mozilla Thunderbird, I see it in dovecot-keywords file, but plugin don't view it in RC. So I decided to change plugin or write new.
2011/4/5 A.L.E.C alec@alec.pl:
W dniu 2011-04-05 10:54, Алексей Сундуков pisze:
Now I see, I wrong. You right, stored tag in to email header is bad place.
Take a look at this Roundcube plugin http://www.roundcubeforum.net/7-third-party-contributions/46-api-based-plugi...
-- Aleksander 'A.L.E.C' Machniak http://alec.pl gg:2275252 LAN Management System Developer http://lms.org.pl Roundcube Webmail Developer http://roundcube.net
participants (3)
-
A.L.E.C
-
Timo Sirainen
-
Алексей Сундуков