Bug 2451 - Notification does not work on imap.gmail.com
Summary: Notification does not work on imap.gmail.com
Status: NEW
Alias: None
Product: Claws Mail (GTK 2)
Classification: Unclassified
Component: Plugins/Notification (show other bugs)
Version: 3.7.9
Hardware: PC Linux
: P3 enhancement
Assignee: users
URL: imap.gmail.com
Depends on:
Blocks:
 
Reported: 2011-06-13 20:45 UTC by paulus
Modified: 2022-10-24 12:48 UTC (History)
6 users (show)

See Also:


Attachments
make claws notification plugin notify on unread mail, rather than new mail (1.29 KB, patch)
2012-04-30 17:00 UTC, Romain GUINOT
no flags Details | Diff
Patch to notify on unread and new messages (1.45 KB, patch)
2012-08-16 11:03 UTC, Anton Butanaev
no flags Details | Diff
Patch to notify on unread and new messages, configurable (4.09 KB, patch)
2012-08-17 13:02 UTC, Anton Butanaev
no flags Details | Diff
Notify on unread messages also in the systray (789 bytes, text/plain)
2022-10-24 12:46 UTC, NSLW
no flags Details
Notify on unread messages also in the systray (5.15 KB, patch)
2022-10-24 12:48 UTC, NSLW
no flags Details | Diff

Description paulus 2011-06-13 20:45:17 UTC
Using Google IMAP and my mails don't come in as "New" but as "Unread"

Does not work sound notification, command to execute:
aplay ~/.claws-mail/sounds/vhodyaschee_soobschenie.wav

No show popup for new "Unread" messages on imap.gmail.com
Really need to sound an alert. Please fix it.
Notification plugin version: 0.27
Comment 1 Holger Berndt 2011-06-13 21:02:14 UTC
The purpose of the notification plugin is to notify of "New" messages. If Gmail decides that no messages are "New" in its IMAP implementation, you won't get a notification. That's not a bug.

Leaving open as enhancement request, because I guess the plugin could be modified to optionally look at the "Unread" flag instead of the "New" flag, to work around this design decision in Gmail.
Comment 2 paulus 2011-06-14 07:23:10 UTC
Thanks. The module does not remember the marked folder (Only include selected folders), after reboot the client missing the mark, especially with RSSyl and Meetings (vCalendar).
Comment 3 Romain GUINOT 2012-04-30 16:57:24 UTC
Hi, 

My company has recently moved to Google Apps.
Therefore i have also been faced by this issue.

Since i rely on notifications working, and system tray icon changing according to mail situation, i have made this small patch to allow the notification plugin to notify on unread emails, not on new/recent mail. 

It is not a definitive patch, since it's not configurable. it replaces the current behaviour with the adapted one. Ideally, a config option would drive that choice, but my claws codebase skills are currently limited. i went for a simple solution to my current situation, which was quick and easy to implement. 

I attach the patch here in case someone else would like to 'fix' that locally for them too, but not that in its current form it should not be adopted in the general product.
Comment 4 Romain GUINOT 2012-04-30 17:00:33 UTC
Created attachment 1108 [details]
make claws notification plugin notify on unread mail, rather than new mail

adding the patch with regard to my previous comment : make claws notification plugin notify on unread mail, rather than new mail (aka \Recent IMAP flag).

A small drawback is that if you mark an email as unread after reading it, a notification will pop up... for now, i can live with that.

Regards,
Romain.
Comment 5 Anton Butanaev 2012-08-16 11:03:39 UTC
Created attachment 1144 [details]
Patch to notify on unread and new messages
Comment 6 Anton Butanaev 2012-08-16 11:05:49 UTC
Hi!

I was recently affected by this bug/feature also. The first problem is Gmail, another one appears in my work IMAP account. When I select some IMAP folder in Claws Mail and stay there messages don't come as new in that folder but as unread and notification isn't triggered.

Attaching another patch enabling notification on unread and new messages.

Anton
Comment 7 Ricardo Mones 2012-08-16 13:53:35 UTC
This patch makes notification appear when there's unread messages even on servers which are IMAP compliant and therefore support the new flag.

You need to turn this on only when the server is Gmail's pseudo-IMAP, not for every server, so some configuration GUI for the user should be present. Maybe a list of server name patterns to check against as harcoding servernames ending in gmail.com or googlemail.com will hurt people using Gmail on it's own domain.
Comment 8 Ricardo Mones 2012-08-16 13:56:07 UTC
I mean "people using Gmail on their own domain" ;-)
Comment 9 Anton Butanaev 2012-08-16 15:33:05 UTC
What so wrong with notifying on unread messages as well as on new ones? They are not read and I do want to see them and to be notified. I do not quite get the idea that notification goes for new messages only. Message came, new or unread, it should be seen anyway.

And this is not only Gmail issue. I use totally independent from Gmail IMAP server at work, and when mail comes into folder which currently selected in Claws, it appears as unread, now new. In other folders it comes as new. When I go to see another folder in Claws, the story continues there: mail arrives as unread but in previously selected folder it now arrives as new.

And it always arrives as unread in Gmail, selected folder or not.
Comment 10 Holger Berndt 2012-08-16 16:19:15 UTC
> Message came, new or unread, it should be seen anyway.

If the "New" flag is not set, it means that the user has seen the message before (possibly on another computer, with a different MUA). I don't want to be notified of messages repeatedly. Just once, when it's ... well ... "New".

> I use totally independent from Gmail IMAP server at work,
> and when mail comes into folder which currently selected
> in Claws, it appears as unread, now new.

That sounds like a bug in Claws Mail and/or you mail provider, then. The "New" flag is supposed to be set on new messages, regardless of whether you're in the folder or not. Messing up terminology in this plugin is not the right way to deal with the issue.
Comment 11 Anton Butanaev 2012-08-16 16:38:26 UTC
Do you mean that if I read mail at work and leave some messages Unread, then go home and see mail there, I'll be notified on all messages left Unread again? Well, then I understand the difference between the New and Unread. At least how it should be in the ideal world. But as we all now see it's just not working this way... And people who use Gmail, they are many out there... Maybe make this configurable? I saw similar option in the code for banner notification, variable named unread_also.
Comment 12 Ricardo Mones 2012-08-16 16:55:17 UTC
BTW, there's nothing intrinsicaly wrong on that kind of notification. The problem is that the current plugin code clearly discriminates to notify on new and/or to notify on unread in the GUI (see Configuration/Preferences/Plugins/Notification page).

I don't understand why checking both options (or just unread in the case of Gmail) doesn't already work for you, which could mean some other bug somewhere.
Comment 13 Holger Berndt 2012-08-16 18:38:29 UTC
#11:
> At least how it should be in the ideal world.
> But as we all now see it's just not working
> this way...

In fact, it is already like that. In the real world.

It's just your provider that's messed up. And I am not willing to break the plugin for everybody (including myself) to workaround a provider bug / design.

> And people who use Gmail, they are many out there... Maybe make
> this configurable?

Obviously not enough. I already mentioned in comment #1 that I would be willing to apply a (clean) patch. It's just that I am unlikely to do it myself anytime soon.

The setting should be configurable, preferably per Mailbox.

#12:
> The
> problem is that the current plugin code clearly discriminates to notify on new
> and/or to notify on unread in the GUI (see
> Configuration/Preferences/Plugins/Notification page)

I'm not sure what setting you are refering to. On that page, there's an option for setting the window manager urgency hint on unread messages. That's something else, and has nothing to do with popups or the like.
Comment 14 Anton Butanaev 2012-08-17 13:00:49 UTC
Holger,

Well here is another try with patches... I added checkbox for popup notification configuration dialog, named "Notify on unread also", and now this becomes configurable. It's analogous with banner notification and urgent stuff (there are similar checkboxes on those dialogues, without folder selection). What's left wrong in the patch is that the command notification will seem to get Unread messages now. This can be fixed adding similar checkbox there. So if this is right way I can follow up with this patch after your review.

Anton
Comment 15 Anton Butanaev 2012-08-17 13:02:49 UTC
Created attachment 1145 [details]
Patch to notify on unread and new messages, configurable
Comment 16 Holger Berndt 2012-08-17 21:59:28 UTC
The setting should be configurable per mailbox. It doesn't need to be configurable per notification module. No need to have an option in both, popup, and command - but there should be a global setting which mailbox this applies to, analogous to the folderselection dialog (only that it doesn't list folders, but mailboxes).
Comment 17 julesmoules@gmail.com 2013-04-07 12:01:19 UTC
I don't wish to use the notification plugin - it doesn't work properly for me, anyway.

And I have the same problem with the lack of notifications of New messages from gmail (from this thread: they're flagged Unread). I accept in Google's problem.

Couldn't a much simpler solution to this problem be to provide another variable (say, %u) for unread messages in the same way that you already provide a variable for new messages (%d) in the user Command to Execute after checking mail in Preferences - Mail Handling - Receiving.

This way, you wouldn't have to barf at explicitly configuring anything for gmail and would also be providing a genuinely useful additional variable for the user Command to Execute that might be of use to more users.

This is what I prefer to use for notification anyway - just pop up a Zenity window from a script that my particular command invokes after checking for mail.
Comment 18 evg 2014-05-22 18:08:49 UTC
The same is not working popup and sound notifications. Only this time mail.ru server protocol imap. Many times complain can already do anything?
Comment 19 Daniel Bedrenko 2014-05-22 19:20:30 UTC
@evg: From my conversation with "claws" on the Freenode channel I have the impression that this bug is a WONTFIX, so just use the patch attached.
Comment 20 Andrej Kacian 2016-10-11 20:19:11 UTC
The patch still works on 3.14.0, after some fixing - you put some added parts into conditional blocks within #ifdef HAVE_LIBNOTIFY, and some outside of them.

If the per-mailbox (or per-account) setting for this is added, as Holger mentions in config 16, I see no problem in accepting this patch for next release.
Comment 21 NSLW 2022-10-24 12:46:10 UTC
Created attachment 2308 [details]
Notify on unread messages also in the systray
Comment 22 NSLW 2022-10-24 12:48:12 UTC
Created attachment 2309 [details]
Notify on unread messages also in the systray

Attaching updated patch that works with Claws Mail 4.1 as well.

Just place it in the main Claws Mail directory and call
"patch -p1 < 0001-Notify-on-unread-messages-also-in-the-systray.patch"
in terminal.

(In reply to Holger Berndt from comment #16)
It would be nice to have this setting configurable per mailbox. That would involve more work though and the users (me included) seems to be already satisfied with Anton's solution.

I'm not sure but it seems to me that Anton's solution works the same as "Include unread mails in banner" and it's also not configurable per mailbox there. It seems to me hat Anton would like to get the same functionality for the systray icon as for the banner. It would help a lot of users (i.e. gmail userbase) to get their notifications right.

Note You need to log in before you can comment on or make changes to this bug.