viernes, 20 de noviembre de 2015

Mu4e and gmail (multiple accounts)

Using Emacs for reading mails is super neat and all, but honestly, gmail does an amazing job managing mails.  To make things even 'worse', I wrote some small js to ease the process of managing multiple gmail accounts in conkeror.

I tried to replace gmail with gnus multiple times, but it never worked out very well. Mu4e seems the most sensible choice, but I always had issues configuring it for my gmail accounts ("Your IMAP server wants to alert you to the following: Please log in via your web browser: (Failure)" being the last one), but I finally got to solve them.

If you get the "Please log in via your web browser" there are 2 ways of solving it.
  1. As explained here, allow less secure apps, by going to your accouts settings. This may not work in your company account (if they disabled this option)
  2. Add an application password token. By going to your security settings. and adding a new 'application password'. You can use that token in your .offlineimaprc  file.

Once the basic configuration was working, and read pretty much all the docs and blogs on the field, I quickly got annoyed by the 'dashboard' view mu4e offers.  It provides exactly 0 useful info.  So I got rolled up my sleeves and wrote this tiny little function to do my usual actions in mu4e:

I want to know about new mails in both my personal and corporate accounts.

(defun mnew ()
  (mu4e-headers-search-bookmark "flag:unread AND NOT flag:trashed AND maildir:/ OR 
                                 flag:unread AND NOT flag:trashed AND maildir:/"))

Not very nice, I know, but for now, it already provides me something I wanted and wasn't quite possible in gmail. also, I don't have to visit the mu4e 'dashboard'.

Ah!, to periodically fetch new mails, for now I'm going with elisp's timer `run-at-time'.

(run-at-time nil (* 60 5) 'mu4e-update-mail-and-index t)

No hay comentarios: