Gnus, GMail, OS X and Other Goodness

In October, Bill Clementson tried to get gnus setup with gmail on OS X and had some trouble. However, he inspired me and now I’m reading my gmail from gnus on my Apple powerbook and I’m very happy with the setup. Here’s a quick guide to how I set everything up:

Required Software

Required Reading

These articles will help you:

The Setup

My setup is as follows:

  • fetchmail downloads email from gmail and puts it in my local mail spool file at /var/mail/farra
  • gnus reads the email from my local mail directory
  • gnus sends the email to my own smtp server (not gmail’s)
  • bbdb stores my address book
  • contacts-bbdb allows a one way sync from OS X Address Book to bbdb via the ‘contacts’ program
  • I’ve also setup rss2email to download rss feeds and add them to my local mail spool

Now, you could say using fetchmail to get my email is cheating and I really should have used POP directly from gnus. Well, direct pop access is possible but it’s a bit messy due to gmail’s use of SSL. Since I didn’t want to deal with getting packages from CVS, fetchmail seemed like a decent solution. And it works. And it means gnus starts up faster because the POP download happens in the background with fetchmail (though you can setup gnus to run fetchmail on loading gnus). I prefer to control when fetchmail runs myself either via cron or manually.

Gnus can also directly subscribe to RSS feeds but this also slows down the loading process. So I’m using rss2email instead. There are other RSS to email programs and services, so pick your poison. There’s also an RSS to local newsreader program, nntp//rss, which is actually pretty nice and I’ve thought of switching to that but I’m not sure if I want to deal with yet another server running in the background constantly.

My .gnus.el File:

;; .gnus.el for J Aaron Farr

(setq user-mail-address "farra@apache.org")
(setq user-full-name "J Aaron Farr")

;; news and mail sources
(setq gnus-select-method '(nntp "news.gmane.org"))
(add-to-list 'gnus-secondary-select-methods '(nntp "localhost"))
(add-to-list 'gnus-secondary-select-methods '(nnml ""))
(setq mail-sources '((file :path "/var/mail/farra")))

;; pop settings for cubiclemuses used for testing
;;(setq mail-sources '((pop :server "mail.cubiclemuses.com" 
;;              :user "farra" 
;;              :password nil)))

;; outgoing settings
;; these settings are just for my SMTP server
;; gmail's are different.  see Bill's article
(setq smtpmail-smtp-server "mail.cubiclemuses.com" 
      smtpmail-default-smtp-server "mail.cubiclemuses.com" 
      send-mail-function 'smtpmail-send-it
      message-send-mail-function 'smtpmail-send-it
      smtpmail-smtp-service 25
      smtpmail-auth-credentials '(("mail.cubiclemuses.com" 
                   25
                   "farra@cubiclemuses.com" 
                   nil)))

;; comes in handy
;;(setq smptmail-debug-info "t")

(require 'bbdb)
(bbdb-initialize 'gnus 'message)

;; gnus customization
(setq gnus-summary-line-format ":%U%R %B %s %-60=|%-20,20f |%&user-date; \n")
(setq gnus-sum-thread-tree-single-leaf " »")
(setq gnus-sum-thread-tree-leaf-with-other " »")

;; fetch old headers when a new follow-up arrives
(setq gnus-fetch-old-headers t)

;; mail splitting
;; haven't finished this yet, but here's an example
(setq nnmail-split-methods 'nnmail-split-fancy)
(setq nnmail-split-fancy
      `(| ("User-Agent" "rss2email" "rss.feeds")
      (from "JIRA" "mail.apache.jira") 
          (any "svn commit" "mail.apache.commits") 
          ("Mailing-List" "contact \\[-a-z]*\\-help@\\[.a-z]*\\apache.org" "mail.apache.\\2\\1") 
          ;; unmatched goes to misc
          "mail.misc"))

.fetchmailrc

here’s my fetchmail file:

set daemon 300
set syslog
poll pop.gmail.com with proto POP3
    user 'jaaronfarr@gmail.com' there with password 'my_password' is farra here
        options keep ssl sslfingerprint '59:51:61:89:CD:DD:B2:35:94:BB:44:97:A0:39:D5:B4'
            sslcertck sslcertpath /usr/share/ssl/certs

I hope that helps. It can still be a long and confusing process, so take your time and read the documentation thoroughly. Also the gnus newsgroup and archives helped a lot too. Good luck!