Using GMail from Gnus on Ubuntu Hardy

I have used GNUS (Emacs news/mail reader) to read mail for ages, so I wanted to use it to access my GMail account as well.

I managed to get it to work on my Ubuntu Hardy installation, though not without some hacking (I did not spend that long looking for a cleaner way).

GMail supports both POP and SMTP, so that is the basics for getting it to work, but the problem is that TLS/SSL is required for both and getting that configured in Gnus was a bit tricky for me. But I got it working in the following way:

  1. sudo apt-get install gnutls-bin gnutls-doc starttls
  2. The smtpmail.el included in emacs21 does not handle TLS (and the gnus package depends on emacs21, did not check if gnus is available for emacs22 in Ubuntu Hardy). But Gnus comes with another smtpmail.el which does support TLS, so I copied that into my load path instead (/usr/share/doc/gnus/contrib/smtpmail.el.gz).
  3. I had to hack this small patch into smtpmail.el to get it to use STARTTLS, not sure what the real problem is here:
        --- smtpmail.el 2008/06/06 18:12:50 1.1
        +++ smtpmail.el 2008/06/06 18:13:15 1.2
        @@ -472,7 +472,7 @@
           (let ((cred (smtpmail-find-credentials
                       smtpmail-starttls-credentials host port)))
             (if (null (and cred (condition-case ()
        -                       (with-no-warnings
        +                       (progn
                                      (require 'starttls)
                                      (call-process (if starttls-use-gnutls
  4. Configure pop and smtpmail in .emacs:
    (setq gnus-secondary-select-methods '((nnml "")))
    (setq mail-sources
          '( (pop :server "" :port 995 :user "" :stream ssl)
    (setq nnmail-pop-password-required t)
    (setq smtpmail-smtp-server "")
    (setq smtpmail-smtp-service 587)
    (setq smtpmail-local-domain nil)
    (setq smtpmail-auth-credentials '(("" 587 "" nil)))
    (setq smtpmail-starttls-credentials '(("" 587 nil nil)))
    (setq send-mail-function 'smtpmail-send-it)
    (setq smtpmail-default-smtp-server "")
    (setq smtpmail-debug-info t)
    (setq message-send-mail-function 'smtpmail-send-it)

So a bit of a pain, but I got it to work (and I am really used to Gnus by now and would hate to switch to something else).

Leave a comment

Your email address will not be published. Required fields are marked *