I generally like Gmail, but there's something about well formatted, color highlighted plain text over a black background that appeals to me a lot. I'd like to be able to use Emacs to read/send email using my Gmail account, but setting it up is infuriatingly difficult. I tried a bunch of extensions and tutorials, but none of them gave me a fully working email setup for Emacs.

This is going to be my last try before I give up. I'm on Ubuntu 11.10, standard Unity shell, using Emacs 23.3. Please tell me once and for all how to get this to work.


Gnus seems to have some instructions for GMail. Using IMAP is probably best since it leaves mail accessible with other clients and the web interface if something goes wrong locally.


I use offlineimap + dovecot for having the mails localy.

My .offlineimaprc is:

accounts = Locals, Gmail
maxsyncaccounts = 2

[Account Gmail]
localrepository = Local
remoterepository = Remote
autorefresh = 5

[Repository Local]
type = Maildir
localfolders = ~/Maildir

[Repository Remote]
type = Gmail
remotehost = imap.gmail.com
remoteuser = my.email@gmail.com

My /etc/dovecot.conf contain:

default_mail_env = maildir:%h/Maildir

and my .gnus have:

(setq imap-shell-program "/usr/lib/dovecot/imap")

(setq gnus-secondary-select-methods
      '((nndraft "")
        (nnimap "localhost"
         (nnimap-stream shell)))))

For outgoing mail I use:

(setq send-mail-function 'smtpmail-send-it)
(setq message-send-mail-function 'smtpmail-send-it)
(setq smtpmail-starttls-credentials '(("smtp.gmail.com" 587 nil nil)))
(setq smtpmail-auth-credentials '(("smtp.gmail.com" 587 "my.email@gmail.com" nil)))
(setq smtpmail-default-smtp-server "smtp.gmail.com")
(setq smtpmail-smtp-server "smtp.gmail.com")
(setq smtpmail-smtp-service 587)

And it just work.

  • I installed dovecot and it warned me that its "conf file does not belong to the current user". Not sure what to do with this. Also, I couldn't find the imap shell program. There's no imap file in /usr/lib/dovecot – EpsilonVector Dec 8 '11 at 6:52
  • I don't know how you installed dovecot. I use Debian, and the dovecot package from debian unstable (package dovecot-imapd) – Rémi Dec 8 '11 at 18:57

wl does the job too

Wanderlust http://www.gohome.org/wl/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.