Mew is yet-another mail reader for emacs.
To install: download and unpack, run ./configure && make && make install. Initial setup is done in .emacs. Main configuration file for mew is ~/.mew.el, which is loaded after mew is started. If you use emacs 23, you should use at least Mew version 6.2.52 (beta).
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; mew -- mail (autoload 'mew "mew" nil t) (autoload 'mew-send "mew" nil t) ;; Optional setup (Read Mail menu for Emacs 21): (if (boundp 'read-mail-command) (setq read-mail-command 'mew)) ;; Optional setup (e.g. C-xm for sending a message): (autoload 'mew-user-agent-compose "mew" nil t) (if (boundp 'mail-user-agent) (setq mail-user-agent 'mew-user-agent)) (if (fboundp 'define-mail-user-agent) (define-mail-user-agent 'mew-user-agent 'mew-user-agent-compose 'mew-draft-send-message 'mew-draft-kill 'mew-send-hook))
(setq mew-name "full name") (setq mew-user "name") ; from name@domain (setq mew-mail-domain "domain") (setq mew-smtp-user "name@domain") (setq mew-smtp-server "smtp.domain") (setq mew-smtp-auth-list '("LOGIN")) ; "CRAM-MD5", "PLAIN", and "LOGIN" can be used ;; i use fetchmail to get mail from all boxes to /var/mail/banan (setq mew-mailbox-type 'mbox) (setq mew-mbox-command "incm") (setq mew-mbox-command-arg "-u -d /var/mail/username") (setf mew-mail-path "~/.mail") ;; some customization (setq mew-use-unread-mark t) (setq mew-summary-form '(type " " (5 date) " " (5 time) " " (30 from) " " t (0 subj))) (setq mew-summary-form-extract-rule '(address)) ;; make mew to show date in "dd/mm" format in summary instead of "mm/dd" (defun mew-summary-form-date () "A function to return a date, DD/MM." (let ((s (MEW-DATE))) (when (or (string= s "") (not (string-match mew-time-rfc-regex s))) (setq s (mew-time-ctz-to-rfc (mew-file-get-time (mew-expand-msg (MEW-FLD) (MEW-NUM)))))) (if (string-match mew-time-rfc-regex s) (format "%02d/%02d" (mew-time-rfc-day) (mew-time-mon-str-to-int (mew-time-rfc-mon))) "")))
In versions 6.1 and 6.2 I found that I can’t send email because of very strange error: draft file was meant to be renamed to +queue, but was deleted before renaming. I wrote to the author, but he didn’t reply.
So if you have such a problem, just add this to you .mew.el:
;; bugfix ;; draft was deleted before it could be renamed to +queue ;; redefine that function to fix this (defun mew-encode-save-draft () (mew-frwlet mew-cs-dummy mew-cs-text-for-write (write-region (point-min) (point-max) (buffer-file-name) nil 'no-msg) (clear-visited-file-modtime) ;;;(mew-delete-file buffer-auto-save-file-name) ; delete draft too early? (set-buffer-modified-p nil)))
(autoload 'bbdb-insinuate-mew "bbdb-mew" "Hook BBDB into Mew") (add-hook 'mew-init-hook 'bbdb-insinuate-mew) (setq bbdb-send-mail-style 'mew)
The way bbdb-mew works:
If you also want bbdb to do the tab-completion of e-mail adresses in draft composition buffers, customize Mew’s variables mew-field-completion-switch (for “<tab>” completion) and/or mew-field-expansion-switch (for “M-<tab>” completion). You can replace all occurances of mew-complete-address by bbdb-complete-name.
By default, Mew 6.3 does not work with Stunnel 4.33 under Windows XP/32. A quick’n’dirty workaround is modifying mew-ssl.el:
(insert "client=yes\n") ; (insert "pid=\n") (insert (format "verify=%d\n" (mew-ssl-verify-level case))) ; (insert "foreground=yes\n") (insert "debug=debug\n") ; (if (>= mew-ssl-minor-ver 22) ; (insert "syslog=no\n")) (insert "CApath=" (expand-file-name (mew-ssl-cert-directory case)) "\n")
(defun mew-ssl-setup () (setq mew-ssl-ver 4) (setq mew-ssl-minor-ver 33))
To send attachment using rfc2047 encode the mew header, patch the mew-header.el by modifying function mew-header-insert like this(in mew6.3.50 beta):
(defvar *mew-header-encoding-method* :rfc2047) (defun mew-header-insert (key value &optional no-fold) (if (and value (stringp key)) (let ((beg (point)) params med parname parval) (when (listp value) (setq params (cdr value)) (setq value (car value))) (insert key) (insert " ") (setq med (point)) (if (string-match "^[\t -~]*$" value) (insert value) (mew-header-encode-text value nil (length key))) (dolist (par params) (mew-set '(parname parval) par) (insert ";") (cond ((string-match "^[-a-zA-Z0-9]+$" parval) ) ;; do nothing ((and (string= (mew-charset-guess-string parval) mew-us-ascii) (not (string-match "\"" parval))) (setq parval (concat "\"" parval "\""))) (t (case *mew-header-encoding-method* (:rfc2047 (when (loop for c across parval thereis (> c 255)) (setq parval (concat "\"" (rfc2047-encode-string parval) "\"")))) (t (setq parval (mew-param-encode parval)) (setq parname (concat parname "*")))))) (insert " " parname "=" parval)) (insert "\n") (unless no-fold (mew-header-fold-region beg (point) med)))))
by Jingtao Xu
To view Html messages in Message Mode, you can either install w3m etc, or insert the following in your .mew.el :
(setq mew-prog-text/html 'etk-mime-text/html) (defun etk-mime-text/html (begin end) (save-excursion (goto-char (point-min)) (shell-command-on-region begin end "html2text -nobs" nil t) ) )
Is there a way to let mew remember the password for a pop3 account? I already set the timeout rather high and activited caching.
(setq mew-use-cached-passwd t) (setq mew-passwd-timer-unit 1000)
But I want to save it in my .emacs, so it don’t need to retype it, when I startup emacs.
A: You can.
(setq mew-passwd-alist '(("firstname.lastname@example.org:imap" "password" 0)))
To use different signature file for different Email address, include following line in each account’s setting
("signature-file" . "/location/of/signature")
Fighting Spam: bogofilter in Mew Sven Hartrumpf offers another way to use Bogofilter in Mew. (http://pi7.fernuni-hagen.de/hartrumpf/bogofilter_in_mew.html)
Install a recent version of Mew and bogofilter. Then create a script called bogo containing the following lines:
#! bogofilter -v -T -B $* | grep -e ' S ' -e ' U '
(Leave out -e ‘ U ‘ if you don’t want to mark messages classified by bogofilter as unsure.) Add to your .emacs (or .emacs.mew or similar Emacs’ init file):
(setq mew-prog-grep "bogo")
Type ls on spam message (in Mew’s summary mode). (ls stands for learn spam.) Type lh on ham message (in Mew’s summary mode). (ls stands for learn ham.)
In Mew, press “?”. bogo will be presented as the default program, so just press return when shown. This will mark spam (and unsure, see above) messages. Then put delete mark on all marked messages: md Later: press x (to delete really).