Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tags #419

Closed
yeupou opened this issue May 26, 2022 · 26 comments
Closed

Tags #419

yeupou opened this issue May 26, 2022 · 26 comments
Labels
enhancement New feature or request

Comments

@yeupou
Copy link

yeupou commented May 26, 2022

With some hard clients like Mozilla Thunderbird and some web clients like Roundcube, it is possible to tag messages consistently
(Important/Work/Personal). So I assume these tags are passed through IMAP.

Would you consider implement such tags support in Snappymail?

(I'd like to thank you once again for the great work being done on Snappymail. Really a cool piece of software).

Regards,

@the-djmaze
Copy link
Owner

the-djmaze commented May 26, 2022

I'm sorry to say, but it's not part of IMAP standards.
Only "flags" are defined and that is not the same as tags.

However, the solution is to use a local storage to store tags with uid of message in the folder.

Moving a message generates a new uid so needs tagging again.

Thunderbird and RoundCube use databases to manage these and the problem is that you can't share tags between these programs easily.

So, the solution is to modify the message and add/edit x- headers or custom flags to manage these.

@yeupou
Copy link
Author

yeupou commented May 28, 2022

Hi,

It is odd, with my company setup (no clue exactly how it is set up), we have both Thunderbird and Roundcube, and the tags shows in both clients:

  • they do not use flags for this (flags are also used, but same as Snappymail, no issue with flags).
  • It do not see anything in the mails headers regarding these.

Maybe it uses this:
https://github.com/mike-kfed/roundcube-thunderbird_labels
https://sourceforge.net/projects/tagspluginrc/
("will follow the same semantic as Thunderbird to manage tag, so tags set using this plugins will be seen in Thunderbird and vice-versa")

update:
or maybe these headers are treated as internal and not visible in view source/download .eml.

@the-djmaze
Copy link
Owner

Found it!
When the IMAP server supports "*" flags, the Thunderbird "labels" are stored as flags.
These are marked as $label1 or $Label1 (no idea which is correct).
There are a few hard-coded:

0 – Remove all tags
1 – Important
2 – Work
3 – Personal
4 – To Do
5 – Later

To know if this is correct, and works in SnappyMail:

  1. open browser debug network tab
  2. open a message that should have "labels"
  3. click on the request in the network tab and check the result

The labels should be in the Flags part
afbeelding

the-djmaze pushed a commit that referenced this issue May 29, 2022
@yeupou
Copy link
Author

yeupou commented May 29, 2022

I did a test setting "Work" in Thunderbird

I get:

Flags | [ "\seen", "$label2" ]
0 | "\seen"
1 | "$label2"

(But soon enough it disappears. I wonder if it is not Snappymail that actually remove the extra flag. Because if I do not manipulate the messages with Snappymail, it seem to stay. But it might be offlineimap sync between servers

update: ahem, confirmed as probably caused by offlineimap OfflineIMAP/offlineimap#209 https://lists.gnu.org/archive/html/info-gnus-english/2011-10/msg00052.html )

@the-djmaze
Copy link
Owner

ahem, confirmed as probably caused by offlineimap

You could try https://imapsync.lamiral.info/ instead.
I use that to migrate accounts.

@the-djmaze
Copy link
Owner

the-djmaze commented May 30, 2022

I've installed Thunderbird to make an additional test with custom tags.
As it seems you can:
afbeelding

The result is not $label## but just the name test:

IMAP[DATA]: > TAG3 SELECT "INBOX"\r\n
IMAP[DATA]: < * FLAGS (\Answered \Flagged \Deleted \Seen \Draft $FORWARDED $SENT $SIGNED $TODO $ERROR $QUEUED $label1 $label5 test)\r\n
IMAP[DATA]: < * OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen \Draft $FORWARDED $SENT $SIGNED $TODO $ERROR $QUEUED $label1 $label5 test \*)] Flags permitted.\r\n
IMAP[DATA]: < * 542 FETCH (... FLAGS (\Seen $label1 $label5 test) ...)

As you can see i also have a few others. They are from Kmail:

$ERROR
$ATTACHMENT
$INVITATION
$SENT
$QUEUED
$REPLIED
$FORWARDED
$TODO
$WATCHED
$IGNORED
$SIGNED
$ENCRYPTED
$JUNK
$NOTJUNK

@yeupou
Copy link
Author

yeupou commented May 30, 2022

Unfortunately imapsync is not doing two-way sync https://imapsync.lamiral.info/FAQ.d/FAQ.Two_Ways_Sync.txt and suggest to use imapoffline or mbsync.

(and I already tried mbsync and got mad with it cf end of https://yeupou.wordpress.com/2014/02/10/replicating-imaps-dovecot-mails-folders-and-sharing-through-owncloud-contacts-kmail-roundcube-etc/ )

@yeupou
Copy link
Author

yeupou commented May 31, 2022

Ok, I found out that interimap seems to be a good alternative, even more efficient.
https://guilhem.org/interimap/

and work out of the box with dovecot.

config is as simple as

$ mkdir -p ~/.config/interimap ~/.local/share
$ cat ~/.config/interimap/config
[local]
type=tunnel
command=exec /usr/lib/dovecot/imap

[remote]
type=tunnel
command=ssh -q OTHERSERVER -p PORT '/usr/lib/dovecot/imap'

Screenshot 2022-06-01 at Boîte mail - e2

Seems to be working fine!
However it is not clear to me how to set the custom flag within Snappymail (not yet implemented maybe!)

I like how you show the color in the small box (however, if there are several flags, maybe they should appear next to the headers while reading the mail)

Anyway, that's great, plus it gave me opportunity to switch to intermap that seems promising.

@the-djmaze
Copy link
Owner

the-djmaze commented Jun 1, 2022

However it is not clear to me how to set the custom flag within Snappymail (not yet implemented maybe!)

Correct, i was only playing with colors and testing custom (unicode/utf-8) tags.
And also added the Thunderbird mode:

/* Thunderbird labels */
/*
.flag-\$label5 .checkboxMessage { background-color: #808; }
.flag-\$label4 .checkboxMessage { background-color: #00F; }
.flag-\$label3 .checkboxMessage { background-color: #080; }
.flag-\$label2 .checkboxMessage { background-color: #FA0; }
.flag-\$label1 .checkboxMessage { background-color: #F00; }
*/
.messageListItem.flag-\$label5.focused { background-color: rgba(255, 0, 255, 0.30); }
.messageListItem.flag-\$label4.focused { background-color: rgba( 64, 64, 255, 0.30); }
.messageListItem.flag-\$label3.focused { background-color: rgba( 0, 255, 0, 0.30); }
.messageListItem.flag-\$label2.focused { background-color: rgba(255, 170, 0, 0.30); }
.messageListItem.flag-\$label1.focused { background-color: rgba(255, 0, 0, 0.30); }
.messageListItem.flag-\$label5:not(.focused) { color: #939; }
.messageListItem.flag-\$label4:not(.focused) { color: #33F; }
.messageListItem.flag-\$label3:not(.focused) { color: #090; }
.messageListItem.flag-\$label2:not(.focused) { color: #F90; }
.messageListItem.flag-\$label1:not(.focused) { color: #F00; }

Which results in dark mode:
afbeelding
Which results in bright mode:
afbeelding

There are so many ways to make it visible (with problems).

For example in Thunderbird you have a message with two keywords (tags), then only 1 color is shown (the other not).
Same idea with my confusing colored checkbox (some people think "why a colored checkbox?!?")

A solution might be to define a color per keyword and then make a linear-gradient() of them and make the list very colorful...
Oh right, colors defeats all purpose for color blinds...

So yes, i am playing but nothing specific yet.

@yeupou
Copy link
Author

yeupou commented Jun 2, 2022

Testing thunderbird, as I did a few test:

  • 1 - important always take over
  • if you add more flags in increasing order (2, 3, 4 ), it keep the first one
  • if you go in decreasing order (5, 4, 3), it actually change over to the newly selected

So Thunderbird use some sort of priority. If there are more than one tag, it should be the most important (except when it's not... sometimes if you toy with flags, it fails to do so).

The linear-gradient idea is interesting but can easily get confusing (especially if we extend to custom colors per user choice). I think Thunderbird approach is reasonable: shows priority tag color in message list and list all tags in the message window

image

Note that Roundcube seems to do the contrary (priority to higher number), which makes sense to give priority to user custom flags but is odd since since "important" get lowest priority.

@the-djmaze
Copy link
Owner

the-djmaze commented Jun 2, 2022

Ok, now it is like thunderbird.
I've made a separate .less file and added the info to the MessageView:
afbeelding

P.S. there is no tag (un)set/manager yet

the-djmaze pushed a commit that referenced this issue Jun 2, 2022
the-djmaze pushed a commit that referenced this issue Jun 3, 2022
@the-djmaze
Copy link
Owner

the-djmaze commented Jun 3, 2022

I've also implemented tag toggle (NOTE: only works with set PermanentFlags, so there might be missing a few).
Could you try this test release and provide feedback if you like it?

snappymail-2.16.3.2.tar.gz
snappymail-2.16.3.2.zip

afbeelding

the-djmaze pushed a commit that referenced this issue Jun 3, 2022
@yeupou
Copy link
Author

yeupou commented Jun 3, 2022

Is there a .deb for this release so I can easily test it?

@the-djmaze
Copy link
Owner

You can try it with this one:
https://snappymail.eu/repository/deb/snappymail_2.16.3.3-1_all.deb

@the-djmaze the-djmaze added the needs feedback Further information is requested label Jun 8, 2022
the-djmaze pushed a commit that referenced this issue Jun 8, 2022
@yeupou
Copy link
Author

yeupou commented Jun 9, 2022

Ok, that is very cool. Seems to work nicely.

Minor cosmetics:

  • french i18n: Work should be translated into Travail instead of Travailler ; tags are translated "Balises", which is correct in french but probably it would be better to use "Etiquettes"', to be consistent with other mail client and a bit more sensible (balise is a tag, but more to delimit something than to mark/tag it) ;
  • 4 tags instead of 5, the "4 - To Do" in blue is missing ;
  • 2 extra flags showing up: $notjunk $readreceipt.

@yeupou
Copy link
Author

yeupou commented Jun 9, 2022

Actually "4 - To Do" is not missing: on some other mail, setting "4 - To Do" with thunderbird, then it is "3 - Personal" in green that is missing.

Also, french i18n "4 - To Do" is translated by "Faire". It should be "À faire" (To = À, Do = Faire)

image
image

the-djmaze pushed a commit that referenced this issue Jun 9, 2022
@yeupou
Copy link
Author

yeupou commented Jun 10, 2022

I also noticed the following:

image

The mail was wrongly flagged as spam so I unspammed it.
It kept an extra junk tag.

The tag list seems to depend on the currently visible tags within a given mailbox.
For some folder, I get none :

image

or else

image

It seems that the number of $oddtags is extensive. Not sure how Thunderbird does it but it ignores them. Maybe it takes into account only the $labelX

@yeupou
Copy link
Author

yeupou commented Jun 10, 2022

If one is picky, Etiquettes => Étiquettes :-) (sorry, the mistake was in my first post about it)

@the-djmaze the-djmaze added enhancement New feature or request and removed needs feedback Further information is requested labels Jun 13, 2022
@the-djmaze
Copy link
Owner

It seems that the number of $oddtags is extensive. Not sure how Thunderbird does it but it ignores them. Maybe it takes into account only the $labelX

Correct, it only uses it own labels.
There are several things to say about this behavior:

  1. Easy to maintain
  2. Only works with Thunderbird (unless others implemented it)

Same deal for KMail and that uses the "star" \Flagged keyword for "Important"

On a user point of view this is really annoying when you use different mail applications (Windows, OSX, Linux, Android, iOS, etc. etc.).
As none will show the same "keywords" when you tagged/labeled a message in one application.
That's why i took the "show all keywords" approach.
However, to give people a start i've now hardcoded the five $labelX tags.

@yeupou
Copy link
Author

yeupou commented Jul 3, 2022

Note that I was toying with the option to activate or remove the checkboxes (in the message list) and it gave strange results: missing tag colors etc.

@mandusm
Copy link

mandusm commented Jul 8, 2022

Woah! This is awesome by the way! I use Sieve to add custom tags to emails all the time and LOVE seeing them pop up in snappy now as well.

Is there a way to add custom tags and colors? Or should I just mess with the CSS?

@yeupou
Copy link
Author

yeupou commented Jul 19, 2022

Testing latest release! Very cool, no issues noticed. Thanks. Enjoy your well-deserved garden shed with double patio and fence! :-)

the-djmaze pushed a commit that referenced this issue Oct 5, 2022
@the-djmaze
Copy link
Owner

the-djmaze commented Oct 5, 2022

I've just improved the Advanced Search window to allow searching for a specific keyword/tag/label
afbeelding

image

@the-djmaze
Copy link
Owner

the-djmaze commented Oct 5, 2022

And now you can create new tags for message (@mandusm would like that)
afbeelding

@the-djmaze
Copy link
Owner

Or should I just mess with the CSS?

Currently: yes
There are so many ways to make it how you like.
For example with my above unicode emoji tag you could do:

.msgflag-🧪 .flagParent::before {
	content: '🧪 ';
}

That makes it like:
image

@simonbuehler
Copy link

i have some strange rendering of the tags combobox
grafik
ff / chrome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants