Emacs with Wanderlust and GMail

Emacs with Wanderlust IMAP mailclient

You have multiple workstations from which you want to approach your email. Maybe because you use both your workstation and your laptop. Or because you want to use email from different locations. Whatever the reason, if you have more than one computer from which you want to have access to your mailboxes, IMAP can provide a good way to get things nicely organized. You could also use a hosted exchange service for extra organization.

The IMAP protocol let you access your mailboxes, open emails to read without removing the mail from the mailserver. So the next time you log in, your email is still there. (Exept when you deliberately want to delete mail).

Most pop3-mailservers can do IMAP.

To approach an IMAP mailserver from within Emacs, you need to install additional software in Emacs. Wanderlust is an proven solution to add IMAP capabilities to Emacs.

Wanderlust and GMail HOWTO

It is very easy to configure Wanderlust to access your GMail account.

Here are the steps to do so:

  1. Get wanderlust
  2. Create ~/.folders
  3. Append the wanderlust configuration to ~/.emacs
  4. Start emacs, start wanderlust and enjoy the most effecient and effective GMail client in the world

Get wanderlust

apt-get install wl

If you don't have Debian, this is where you can find Wanderlust

Create ~/.folders

This is the minimal content of ~/.folders:

%inbox  "inbox"
+trash  "Trash"
+draft  "Drafts"

Append the wanderlust configuration to ~/.emacs

Put this in your ~/.emacs:

;; wanderlust
(autoload 'wl "wl" "Wanderlust" t)
(autoload 'wl-other-frame "wl" "Wanderlust on new frame." t)
(autoload 'wl-draft "wl-draft" "Write draft with Wanderlust." t)

(setq elmo-imap4-default-server "")
(setq elmo-imap4-default-user "<accountname>") 
(setq elmo-imap4-default-authenticate-type 'clear) 
(setq elmo-imap4-default-port '993)
(setq elmo-imap4-default-stream-type 'ssl)

(setq elmo-imap4-use-modified-utf7 t) 

(setq wl-smtp-connection-type 'starttls)
(setq wl-smtp-posting-port 587)
(setq wl-smtp-authenticate-type "plain")
(setq wl-smtp-posting-user "mattofransen")
(setq wl-smtp-posting-server "")
(setq wl-local-domain "")

(setq wl-default-folder "%inbox")
(setq wl-default-spec "%")
(setq wl-draft-folder "%[Gmail]/Drafts") ; Gmail IMAP
(setq wl-trash-folder "%[Gmail]/Trash")

(setq wl-folder-check-async t) 

(setq elmo-imap4-use-modified-utf7 t)

(autoload 'wl-user-agent-compose "wl-draft" nil t)
(if (boundp 'mail-user-agent)
    (setq mail-user-agent 'wl-user-agent))
(if (fboundp 'define-mail-user-agent)

Start emacs, start wanderlust and enjoy the most effecient and effective GMail client in the world

Start emacs and do

M-x wl

Now you will be prompted for your gmail password. After this, you can access your gmail inbox.

If you want to open other mailboxes besides inbox you should add them to your ~/.folders (I have not tested this).

You can send email through your gmail account to. Create a new mail in Wanderlust and send it. You will be prompted for your password again and your mail is sent.

Encrypt your messages

It is a good habit to encrypt all your email messages. See GPG and Emacs with Wanderlust. This way you can also use GnuPG (sometimes called openpgp) with GMail.

Happy emailing!