The last time I talked about using Gmail from Emacs, several people suggested using Wanderlust, an IMAP client written in ELisp. Details for setting it up can be found here; just following those set it up well for reading my email. This worked until I wanted to send a mail from emacs, and found that wanderlust had replaced emac’s send-mail function with it’s own, which didn’t work. I tried for a bit to figure out why it was failing, but eventually gave up on wanderlust and set GNUs up for gmail again.
After this, I decided to try using GNUs for accessing my Gmail again. This process is fairly easy:
put the following in your configuration file:
(setq gnus-select-method '(nnimap "gmail" (nnimap-address "imap.gmail.com") (nnimap-server-port 993) (nnimap-stream ssl)))
Once you have evaluated this expression, do M-x gnus and then S s and enter INBOX. This will switch to your GMail inbox. There are a few problems with this, however. The first is that very few messages are actually presented to you; even though it asked how many to retrieve, and I used a value of ‘100′, only three were presented. I really want to be able to read older mail; If anyone knows how to fix this, please let me know. The other issue, which isn’t as bad, is that read mail does not update the Gmail web interface as read.
Getting back to sending emails, I wrote a function to allow me to easily insert emails. It works for both individual people and multiple addresses.
(defun insert-email () (interactive) (insert (cadr (assoc (ido-completing-read "Name: " (mapcar #'car email-alist)) email-alist)))) (global-set-key (kbd "C-c m") 'insert-email)
This function uses the value of email-alist, which is an alist of names to emails. This doesn’t even have to be used to insert emails; that’s just what I’m using them for. To set email-alist to the proper value, use:
(setq email-alist '(("Name1" "email1") ("Name2" "email2")))
This ends up letting you use Ido to select between name1 and name2 to insert email1 or email2. As I said, it’s more general than what I’m using it for currently - you can use it select any arbitrary text for insertion.
To read older emails in gnus, press ^ to get to the *Server* buffer, then choose the nnimap option. You might also want to consider using offlineimap + dovecot to download your emails and keep a local copy hosted to improve the speed, etc.
To see your old mail, you do a C-u before opening your inbox (ie. C-u ). Then you will see all the messages that are marked as read.