1 ;;; .vm --- Example ~/.vm
5 ;;; Copyright (C) 2007 Robert Widhopf-Fenk
7 ;;; This program is free software; you can redistribute it and/or modify
8 ;;; it under the terms of the GNU General Public License as published by
9 ;;; the Free Software Foundation; either version 1, or (at your option)
10 ;;; any later version.
12 ;;; This program is distributed in the hope that it will be useful,
13 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;;; GNU General Public License for more details.
17 ;;; You should have received a copy of the GNU General Public License
18 ;;; along with this program; if not, write to the Free Software
19 ;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 ;;; You may use this file as a starting point for setting up and customizing
23 ;;; VM to your own needs.
25 ;;*****************************************************************************
26 ;; Make VM your default mail agent in Emacs
27 (setq mail-user-agent 'vm-user-agent)
29 ;;*****************************************************************************
30 ;; Folders and spool files, this is where your mail comes from.
32 ;; vm-spool-files is a list of lists, each sublist should be of the form
33 ;; (INBOX SPOOLNAME CRASHBOX)
37 ;; You can drop mail to the same inbox from different spool files.
38 (list vm-primary-inbox "/var/spool/mail/username1" vm-crash-box)
39 (list vm-primary-inbox "/var/spool/mail/username2" vm-crash-box)
41 (list "spam" (expand-file-name "~spam/drop")
42 (concat vm-folder-directory "spam.crash"))
44 (list "gmail.pop" "pop:pop.google.com:110:pass:YourEmailAddress:*"
45 (concat vm-folder-directory "gmail.pop.crash"))
47 (list "gmail.pop" "pop-ssl:pop.google.com:995:pass:YourEmailAddress:*"
48 (concat vm-folder-directory "gmail.pop.crash"))
50 (list "gmail.imap" "imap:imap.google.com:143:inbox:login:YourEmailAddress:*"
51 (concat vm-folder-directory "gmail.imap.crash"))
54 ;;*****************************************************************************
57 ;; See the recipients for emails you sent instead of yourself.
58 (setq vm-summary-uninteresting-senders
59 (regexp-opt '("@robf.de" "Robert Widhopf-Fenk")))
61 ;; Change the summary format by setting `vm-summary-format'.
62 ;; Run "M-x vm-fix-my-summary!!! RET" to fix existing summaries.
64 ;;*****************************************************************************
67 ;; HTML messages can be converted to text or the w3 resp. w3m Emacs viewers
68 ;; can be used for displaying.
70 (setq vm-mime-type-converter-alist
71 '(("text/html" "text/plain" "lynx -force_html -dump /dev/stdin")
72 ("message/delivery-status" "text/plain")
73 ("application/zip" "text/plain" "listzip")
74 ("application/x-zip-compressed" "text/plain" "zipinfo /dev/stdin")
75 ("application/x-www-form-urlencoded" "text/plain")
76 ("message/disposition-notification" "text/plain")
77 ("application/mac-binhex40" "application/octet-stream" "hexbin -s"))
80 ;; Set up w3m (you should check if it exists)
82 (setq vm-included-mime-types-list
83 '("text/plain" "text/html" "text/enriched" "message/rfc822"))
85 ;;*****************************************************************************
88 (setq mail-default-headers "From: Robert Widhopf-Fenk <hack@robf.de>\n")
90 (vmpc-my-identities "me@company1.nil" "me@home.nil" "me@alterego.nil")
93 ;;*****************************************************************************
94 ;; A hook function to setup mail-composing buffers
95 (defun robf-vm-mail-mode-hook ()
96 "Robert Widhopf-Fenks `vm-mail-mode-hook'."
99 (when (string-match "received" (buffer-name))
100 (make-local-variable 'vm-confirm-quit)
101 (setq vm-confirm-quit t))
105 indent-line-function 'indent-relative-maybe)
107 ;; mark lines longer than `fill-column' chars red
108 (add-to-list 'mail-font-lock-keywords
109 (list (concat "^" (make-string fill-column ?.)
111 '(1 font-lock-warning-face t)))
113 (ispell-change-dictionary "deutsch8")
117 (turn-on-filladapt-mode)
120 ; (auto-capitalize-mode)
121 ; (vm-mail-subject-prefix-cleanup)
124 (add-hook 'vm-mail-mode-hook 'robf-vm-mail-mode-hook)
126 ;; Do you like boxquotes?
129 (defun boxquote-region-and-edit-title (s e)
131 (boxquote-region s e)
132 (call-interactively 'boxquote-title))
134 ;;*****************************************************************************
135 ;; Sending email via SMTP.
137 ;; This is not done by VM, by by separate packages. The standard package is
138 ;; smtpmail.el and it should come with your Emacs. If you have more than one
139 ;; email address and have to send them using different SMTP servers, the you
140 ;; might want to take a look at esmtpmail.el a fork from smtpmail.el targeted
141 ;; to deal with personal crisis support.
143 (setq send-mail-function 'esmtpmail-send-it
144 esmtpmail-default-smtp-server "smtp.someprovider.com"
145 ;; trace buffers help debugging problems
146 esmtpmail-debug-info t)
148 ;; Select the SMTP server based on the From: header, i.e. the email address of
149 ;; the author. There are also other authentication methods, see the docs.
150 (setq esmtpmail-send-it-by-alist
152 '("YourEmaiAddress1" "SMTPSERVER1"
153 (vm-pop-login "pop:SMTPSERVER1:110:pass:YourEmailAddress:*"))
154 '("YourEmaiAddress2" "SMTPSERVER2"
155 (vm-after-pop "pop:SMTPSERVER2:110:pass:YourEmailAddress:*"))))
157 ;;*****************************************************************************
158 ;; Feed mail to a local queue if you are offline
161 (setq send-mail-function 'vm-mail-send-or-feed-it
162 feedmail-enable-queue t
163 feedmail-ask-before-queue nil
164 feedmail-buffer-eating-function 'feedmail-buffer-to-smtpmail
165 feedmail-queue-directory (expand-file-name "~/Mail/QUEUE"))
167 (define-key vm-mode-map "Qr" 'feedmail-run-the-queue)
168 (define-key vm-mode-map "Qc" 'vm-smtp-server-online-p)
169 (define-key vm-mode-map "Qw" 'feedmail-queue-reminder-medium)
171 (setq auto-mode-alist (cons '("\\.fqm$" . mail-mode) auto-mode-alist))
173 ;; Check the queue on startup
174 (when (and (> (car (feedmail-look-at-queue-directory
175 feedmail-queue-directory)) 0))
176 (feedmail-queue-reminder-medium)
178 (if (y-or-n-p "Send messages now? ")
179 (feedmail-run-the-queue)))
181 ;;*****************************************************************************
182 ;; BBDB - the address book for Emacs
184 (require 'bbdb-autoloads)
185 (bbdb-initialize 'vm 'sendmail)
188 ;; create records for people you reply to
189 (add-hook 'vm-reply-hook 'bbdb-force-record-create)
191 ;;*****************************************************************************
192 ;; Now change some keyboard bindings
193 (define-key vm-mode-map [(meta up)] 'vm-previous-unread-message)
194 (define-key vm-mode-map [(meta down)] 'vm-next-unread-message)
195 (define-key vm-mode-map "\C- " 'vm-scroll-backward)
196 (define-key vm-mode-map " " 'vm-scroll-forward)
197 (define-key vm-mode-map "c" 'vm-continue-what-message-other-frame)
198 (define-key vm-mode-map "C" 'vm-continue-postponed-message)
199 (define-key vm-mode-map "R" 'vm-reply-other-frame)
200 (define-key vm-mode-map "r" 'vm-reply-include-text-other-frame)
201 (define-key vm-mode-map "\C-R" 'vm-followup-other-frame)
202 (define-key vm-mode-map "\C-r" 'vm-followup-include-text-other-frame)
203 (define-key vm-mode-map "f" 'vm-forward-message-other-frame)
204 (define-key vm-mode-map "m" 'vm-toggle-mark)
205 (define-key vm-mode-map "d" 'vm-delete-message-action)
206 (define-key vm-mode-map "s" 'vm-virtual-save-message)
207 (define-key vm-mode-map "w" 'vm-save-message-preview)
208 (define-key vm-mode-map "lr" 'vm-delete-message-labels)
209 (define-key vm-mode-map "li" 'rf-vm-label-toggle-important)
210 (define-key vm-mode-map "ls" 'rf-vm-label-toggle-spam)
211 (define-key vm-mode-map "W" 'vm-save-message-sans-headers)
212 (define-key vm-mode-map "W" (make-sparse-keymap))
213 (define-key vm-mode-map "WW" 'vm-apply-window-configuration)
214 (define-key vm-mode-map "WS" 'vm-save-window-configuration)
215 (define-key vm-mode-map "WD" 'vm-delete-window-configuration)
216 (define-key vm-mode-map "W?" 'vm-window-help)
217 (define-key vm-mode-map "x" 'vm-expunge-folder)
218 (define-key vm-mode-map "X" 'vm-expunge-pop-messages)
219 (define-key vm-mode-map "#" nil)
220 (define-key vm-mode-map "/" 'bbdb)
221 (define-key vm-mode-map [(control return)] 'vm-edit-init-file)
222 (define-key vm-mode-map "S" 'vm-save-everything)
223 (define-key vm-mode-map "\C-a" 'vm-mime-auto-save-all-attachments)
224 (define-key vm-mode-map "VO" 'vm-virtual-omit-message)
225 (define-key vm-mode-map "VU" 'vm-virtual-update-folders)
226 (define-key vm-mode-map [(control s)] 'isearch-forward)
227 (define-key vm-mode-map "o" 'vm-switch-to-folder)
229 (define-key vm-summary-mode-map [(control up)] 'previous-line)
230 (define-key vm-summary-mode-map [(control down)] 'next-line)
231 (define-key vm-summary-mode-map [(control s)] 'vm-isearch-forward)
233 (define-key vm-mail-mode-map [tab] 'indent-relative)
234 (define-key vm-mail-mode-map [(control tab)] 'mail-interactive-insert-alias)
235 (define-key vm-mail-mode-map [return] 'newline-and-indent)
236 (define-key vm-mail-mode-map "\C-c\C-i" 'vm-serial-yank-mail)
237 (define-key vm-mail-mode-map "\C-c\C-o" 'vm-serial-expand-tokens)
238 (define-key vm-mail-mode-map [(control c) (control I)] 'vm-serial-insert-token)
239 (define-key vm-mail-mode-map [(control meta delete)] 'kill-this-buffer)
240 (define-key vm-mail-mode-map "\C-c\C-c" 'vm-mail-mode-comment-region)
241 (define-key vm-mail-mode-map "\C-c\C-d" 'vm-mail-mode-elide-reply-region)
242 (define-key vm-mail-mode-map "\C-c\C-k" 'vm-mail-mode-citation-clean-up)
243 (define-key vm-mail-mode-map "\C-c\C-a" 'vm-mime-attach-file)
244 (define-key vm-mail-mode-map "\C-c\C-b" 'boxquote-region-and-edit-title)
246 ;;; Local Variables: ***
247 ;;; mode:emacs-lisp ***