1、安装必要LISP插件和程序
$sudo apt-get install stunnel4
$sudo apt-get install mew //邮件处理程序
$sudo apt-get install w3m w3m-el //用于阅读HTML邮件
2、编辑emacs配置文件
;; mew收发邮件配置
(autoload 'mew "mew" nil t)
(autoload 'mew-send "mew" nil t)
(setq mew-use-cached-passwd t)
(setq mew-pop-delete nil)
;; 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))
(when (boundp 'utf-translate-cjk)
(setq utf-translate-cjk t)
(custom-set-variables
'(utf-translate-cjk t)))
(if (fboundp 'utf-translate-cjk-mode)
(utf-translate-cjk-mode 1))
;;用w3m来读html格式邮件
(setq mew-mime-multipart-alternative-list '("Text/Html" "Text/Plain" "*."))
(condition-case nil
(require 'mew-w3m)
(file-error nil))
(setq mew-use-text/html t)
;;mail account config
(setq mew-config-alist
'(
("default"
(pop-server "pop.126.com")
(name "126")
(user "chenbin512")
(mail-domain "126.com")
(pop-auth pass)
(pop-user "chenbin512@126.com")
(smtp-user "chenbin512@126.com")
(smtp-server "smtp.126.com")
)
("gmail"
(pop-server "127.0.0.1")
(pop-port 9959)
(name "gmail")
(user "chenbin512")
(mail-domain "gmail.com")
(pop-auth pass)
(pop-user "chenbin512@gmail.com")
(smtp-user "chenbin512@gmail.com")
(smtp-server "127.0.0.1")
(smtp-port 4659)
)
("163"
(pop-server "pop.163.com")
(name "163")
(user "pandachen512")
(mail-domain "163.com")
(pop-auth pass)
(pop-user "pandachen512@163.com")
(smtp-user "pandachen512@163.com")
(smtp-server "smtp.163.com")
)
)
)
;;设置邮件签名档
(setq mew-signature-file "~/Mail/signature")
(setq mew-signature-as-lastpart t)
(setq mew-signature-insert-last t)
(add-hook 'mew-before-cite-hook 'mew-header-goto-body)
(add-hook 'mew-draft-mode-newdraft-hook 'mew-draft-insert-signature)
;;设置邮件分类
(setq mew-refile-guess-alist
'(("To:"
("@126.com" . "+Mail/126")
("@gmail.com" . "+Mail/gmail")
("@163.com" . "+Mail/163"))
("Cc:"
("@126.com" . "+Mail/126")
("@gmail.com" . "+Mail/gmail")
("@163.com" . "+Mail/163"))
(nil . "+inbox")))
(setq mew-refile-guess-control
'(mew-refile-guess-by-alist))
;;设置邮件显示栏目
(setq mew-summary-form
'(type (10 date) " " (40 from) " " t (0 subj)))
(setq mew-summary-form-extract-rule '(name))
3、配置stunnel4
对于采用SSL/TLS连接的邮件服务器,需要配置stunnel来提供加密连接,例如:gmail
$sudo vim /etc/stunnel/stunnel.conf
; Protocol version (all, SSLv2, SSLv3, TLSv1)
sslVersion = SSLv3
; Some security enhancements for UNIX systems - comment them out on Win32
chroot = /var/lib/stunnel4/
setuid = stunnel4
setgid = stunnel4
; PID is created inside the chroot jail
pid = /stunnel4.pid
; Some performance tunings
socket = l:TCP_NODELAY=1
socket = r:TCP_NODELAY=1
;compression = rle
; Some debugging stuff useful for troubleshooting
debug = 7
output = /var/log/stunnel4/stunnel.log
; Use it for client mode
client = yes
; Service-level configuration
[pop3s]
accept = 995
connect = 110
[imaps]
accept = 993
connect = 143
[ssmtp]
accept = 465
connect = 25
;;
;; gmail seting
;;
[gmail-pops]
accept = 9959
connect = imap.gmail.com:995
[gmail-imaps]
accept = 9939
connect = imap.gmail.com:993
[gmail-ssmtp]
accept = 4659
connect = imap.gmail.com:465
注:以上配置在ubuntu 12.04上测试通过
4、mew中常用命令和热键
w 撰写新邮件
a 回复邮件,不带引用
A 回复邮件,带引用
f 转发邮件
r 重新发送邮件
SPC 阅读邮件
y 保存文件(可以保存信件全文、信件正文、附件)
C-c C-l 转换当前邮件的编码格式
C-c C-a 加入地址薄
C-u C-c C-a 比 C-c C-a 多加入昵称和名字
C-c C-q 不保存退出
C-c C-a 准备插入附件
mew-attach-copy 用复制方式加入附件
mew-attach-link 用链接方式加入附件
mew-attach-delete 删除附件
C-c C-c 发送邮件
C-c RET 保存邮件到发送队列
C 如果设置了多个邮箱,用 C 命令切换
Q 退出Mew