Using Emacs/VM as a Mail Client

All-in-one version

(Regular [individual slides] version)


Is Emacs/VM For You?

Setting Up the "DOT" files

Both of these are emacs/lisp files in your home directory. See The Gold Book entry for quick-start. Add the following to your .emacs and .vm files to get started:

  load-path (append '("/opt/local/share/emacs/site-lisp/vm",
   "/usr/share/emacs/site-lisp") load-path))

(autoload 'vm "vm" "Start VM on your primary inbox." t)
(listing on separate page)

Isolates vm-specific settings from your .emacs file.

Setting Up the "DOT" files

Trimmed down, sorted version of author's .vm file.

Basic Operations

  • Press ? for help (twice if needed)

  • Can use menu bar for most everything, or keyboard shortcuts:
    • [g]et new mail (for Inbox, or other spool folders)
    • [r]eply to message; [R] includes original (cited)
    • [f]ollowup (reply all); [F] includes original (cited)
    • [z] to forward w/headers; [B]ounce too.
    • [d]elete (gosh!); [#] to expunge
    • [s]ave message in other folder (create/ask if new)
    • [S]ave entire current folder
    • [v]isit another folder
    • [m]ail (start new message); also [e]dit current message
    • [q]uit this folder (or VM entirely if it's the last one)

  • Motion:
    • [p]revious message
    • [n]ext message
    • Arrow keys, then <space> to select.
    • <space> to page through long message; [b]ack up too.

Advanced Use

  • Supercite: fancy citing (quoting) of message when replying

  • Mailcrypt: PGP (doesn't work for PGP 6)

  • Digests: [M-M]ark messages, [M-N]ext command uses marks, [@] create.

  • Incremental search through folder: <esc> Ctrl-s (<esc> Ctrl-S regexp)

  • Virtual folders: [V-C]reate based on many criteria ([?] to list):

    • subject, author, recipient, recent, replied, marked, text, header
    • Regular expressions can be used; extremely powerful.
    • But... can't incremental search them.

References, Esoterica

  • The Manual!

  • Threading: toggle with Ctrl-t

  • Can be used with IMAP, POP3

  • Sorting options (author uses pulldown menu)

  • Attachments! Ctrl-C Ctrl-A to attach item.

Pat Murphy


;;; Mime stuff ("attachments") and browser tie-in.

	'("multipart/mixed" "multipart/alternative"
	  "text/plain" "multipart/signed")
      vm-mime-base64-encoder-program "/opt/local/bin/base64-encode"
      vm-mime-base64-decoder-program "/opt/local/bin/base64-decode"
      vm-mime-qp-encoder-program "/opt/local/bin/qp-encode"
      vm-mime-qp-decoder-program "/opt/local/bin/qp-decode"
      vm-send-using-mime t
	'vm-mouse-send-url-to-netscape ;;; ok w/mozilla too
        ("text/html" "mozilla") ;;; Will launch new browser.
        ("image/gif" "xv")
        ("image/jpeg" "xv")
        ("image/png" "xv")
        ("application/pdf" "acroread")
        ("application/postscript" "gv")
        ("video" "xanim")
        ("audio/x-pn-realaudio" "realplay")
        ("audio" "xwave")

;;; Folders, etc.

      vm-primary-inbox "~/Mail/Inbox"
      vm-folder-directory "~/Mail/"
      vm-crash-box "~/Mail/INBOX.CRASH"
      vm-auto-get-new-mail t
      vm-circular-folders nil
      vm-confirm-new-folders t
      vm-convert-folder-types t

;;; forwarding, replying, etc.

      vm-forwarding-subject-format "[forwarded from %F] %s"
      vm-forwarding-digest-type "rfc934"
      vm-in-reply-to-format nil
	"On %w, %m %d, %y at %h (%z), %F wrote:\n"
      vm-reply-subject-prefix "Re: "

;;; Misc

      vm-mail-header-from "Pat Murphy <pmurphy@nrao.edu>"
      vm-move-after-deleting t
      vm-delete-after-saving t
      vm-edit-message-mode 'indented-text-mode
      vm-follow-summary-cursor t

      vm-default-folder-type 'From_-with-Content-Length
      vm-trust-From_-with-Content-Length t

;;; emacs frames (windows)

      vm-frame-per-composition nil
      vm-frame-per-folder t
      vm-frame-per-edit nil

;;; appearance

      vm-preview-lines nil
      vm-startup-with-summary t
      vm-summary-format "%3n %*%A %-17.17F %-3.3m %2d (%4l) %I%s\n"
      vm-summary-highlight-face "region"
      vm-summary-show-threads nil
      vm-visible-headers '("From:" "Sender:" "To:" "Apparently-To:"
                          "Cc:" "Subject:" "Date:" "Resent-From:"
			  "Message-Id:" "Message-ID:" "Message-id:" 
                          "Resent-Sender:" "X-Zippy")

;;; Multiple VM spool files.  ONLY use this if you use procmail to put
;;; EVERYTHING into one or more spool files on your local disk!!!
;;; Note that it's commented out here. 

;; (setq vm-spool-files
   ;; '(
     ;; Triads: folder you visit, its spool file, and crash file
     ;; External mail Inbox
     ; ("~/Mail/Inbox" "~/Mail/SPOOLS/MAIN" "~/Mail/INBOX.CRASH")
     ;; Junk
     ; ("~/Mail/JUNK"  "~/Mail/SPOOLS/JUNK" "~/Mail/JUNK.CRASH")
;; ))

;;; misc: zap deleted messages when you quit a folder:

(add-hook 'vm-quit-hook 'vm-expunge-folder)

;;; From Bill Cotton: the "l" key prints.  My way!

(define-key vm-mode-map "l" 'print-messages)
(setq print-command "/users/pmurphy/bin/a2ps-mail -2")
(defun print-messages ()
   "Print the selected messages using command in print-command"
   (vm-pipe-message-to-command print-command nil)