Hi, thanks for this awesome software.
I encounter a trouble.
I've enabled a trigger for new mail :
new-email=exec notify-send "New email from %n" "%s"
activated a duration between check in all my accounts :
check-mail = 10m
aerc works fine and notifies me for new mail, but only for the current displayed account tab.
All my accounts are standard imaps mailboxes (dovecot server).
Is there a way to force it to check and notify incoming emails of all mailboxes ?
Note: this may be cumbersome and/or impossible to implement. We would need one IMAP connection per watched mailbox. Some servers limit the number of active connections.
Some servers limit the number of active connections.
my mailboxes are on different servers ;-)
My bad, I thought you wanted notifications for every mailbox of a single account. In that case, did you try the latest master? I don't see what could prevent notifications from being sent for all accounts regardless of which tab is selected.
Unfortunately, I cannot test since I have no imap server that reports the \recent flag.
I use Archlinux package (0.15.1). Should it work on this version ?
notifications work only on the currently displayed account.
And when I switch to another account tab (Ctrl+N), I get a notification for this account if there are unread mails. (check-mail = 10m is set for all my accounts)
I have read the code extensively and can finally explain why the notifications only fire for the selected account.
- An IMAP IDLE command is running and the server notifies that there is a new message in the selected mailbox.
- Aerc performs a
CheckMailaction on the selected mailbox only.
FetchDirectoryContentsreturns the list of message UIDs for the selected mailbox to the UI message store. At that point, the message store contains a new UID for which it does not have headers nor flags.
- When the message list is redrawn, every visible message UID is listed and if it does not have any associated header info, a
FetchHeadersaction is posted to the IMAP backend.
- The IMAP backend sends a request to the server and returns the missing message headers to the UI message store.
- When the message store receives headers, for each message that has the
mail-receivedhook is triggered.
None of the steps starting from 5. will occur unless the message list tab of that account is selected and therefore redrawn.
Changing this behaviour would require tracking what messages are visible to avoid fetching headers for every UID in the message store if they are not displayed (mailboxes can be quite large). And then, move the
FetchHeadersaction directly into the message store, upon
FetchDirectoryContentsresponse if UIDs would be displayed.
OK ~rjarry I see you got the problem !
It seems to break many things to get it working.
Maybe, the notification system should be moved to a completely different part of the code and manage its own list of knows messages (or last known ID). I don't know if it is possible ??
Many thanks to have had a look to it.
Do you need a temporary mailbox on a dovecot IMAP server to do some test ? Let me know by email : jp at f0x dot fr
The extent of changes is not that big. I think it should be easy to incorporate the "visible UIDs" into the message store to allow fetching headers in the background. From a design point of view, it would be better than rely on the UI to ask for backend updates when drawing. I will have a look soon-ish.
No need for a test server. I managed to do that with fastmail IMAP. Thanks though :)
I just sent a patch for you to test: https://lists.sr.ht/~rjarry/aerc-devel/patches/42733
Ok Robin, I've applied these both patches to the master branch and rebuild. I've changed the mail-received=notify-send line in my aerc.conf. However, it always works as previously: notifications display only for current displayed account. Notification arrives when I switch to the concerned account with Ctrl+N
Patch is applied correctly because notification message is ok with account and folder name.
sorry, something is missing to correct the problem.
Can you copy your message as a reply to the patch on the mailing list? It will be better to have a discussion there.