unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Is there a way to know when new email arrived using mu4e-index-updated-hook?
@ 2015-01-08 18:13 Hugo M
  2015-10-04 13:05 ` stardiviner
  0 siblings, 1 reply; 2+ messages in thread
From: Hugo M @ 2015-01-08 18:13 UTC (permalink / raw)
  To: help-gnu-emacs

I have this:

(defun ham-email-arrived-notif ()
  (notifications-notify
    :title "Emails actualizados, m'hijo"
    :body "Quizás tengas un email"
 ;;   :app-icon "~/.emacs.d/icons/mail.png"
    :urgency 'low)  
)
(add-hook 'mu4e-index-updated-hook #'ham-email-arrived-notif)

But it always alerts me when index is updated, even if I have no new email (yes, I noticed the hook's name).

Is there a way to check if there's any unread email in the mu4e index? (or to ask mu4e to retrieve all emails with "unread" flag) 

Thanks!


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Is there a way to know when new email arrived using mu4e-index-updated-hook?
  2015-01-08 18:13 Is there a way to know when new email arrived using mu4e-index-updated-hook? Hugo M
@ 2015-10-04 13:05 ` stardiviner
  0 siblings, 0 replies; 2+ messages in thread
From: stardiviner @ 2015-10-04 13:05 UTC (permalink / raw)
  To: Hugo M; +Cc: help-gnu-emacs


If you're using maildir formats. You can find some solution with Google.
Because maildir use structure Mailbox/{new,cur,tmp}. All new emails are in
Mailbox/new/. So you can detect them with some function.

Hugo M <ham1988@gmail.com> writes:

> I have this:
>
> (defun ham-email-arrived-notif ()
>   (notifications-notify
>     :title "Emails actualizados, m'hijo"
>     :body "Quizás tengas un email"
>  ;;   :app-icon "~/.emacs.d/icons/mail.png"
>     :urgency 'low)  
> )
> (add-hook 'mu4e-index-updated-hook #'ham-email-arrived-notif)
>
> But it always alerts me when index is updated, even if I have no new email (yes, I noticed the hook's name).
>
> Is there a way to check if there's any unread email in the mu4e index? (or to ask mu4e to retrieve all emails with "unread" flag) 
>
> Thanks!




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-10-04 13:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-08 18:13 Is there a way to know when new email arrived using mu4e-index-updated-hook? Hugo M
2015-10-04 13:05 ` stardiviner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).