Chinaunix首页 | 论坛 | 博客
  • 博客访问: 126720
  • 博文数量: 25
  • 博客积分: 742
  • 博客等级: 军士长
  • 技术积分: 323
  • 用 户 组: 普通用户
  • 注册时间: 2007-12-17 00:00
文章分类

全部博文(25)

文章存档

2014年(3)

2013年(4)

2012年(2)

2008年(12)

2007年(4)

我的朋友

分类: LINUX

2014-10-24 21:40:29

1、安装必要LISP插件和程序

$sudo apt-get install stunnel4

$sudo apt-get install mew //邮件处理程序

$sudo apt-get install w3m w3m-el //用于阅读HTML邮件

2、编辑emacs配置文件


点击(此处)折叠或打开

  1. ;; mew收发邮件配置
  2. (autoload 'mew "mew" nil t)
  3. (autoload 'mew-send "mew" nil t)
  4. (setq mew-use-cached-passwd t)
  5. (setq mew-pop-delete nil)
  6. ;; Optional setup (Read Mail menu for Emacs 21):
  7. (if (boundp 'read-mail-command)
  8. (setq read-mail-command 'mew))
  9. ;; Optional setup (e.g. C-xm for sending a message):
  10. (autoload 'mew-user-agent-compose "mew" nil t)
  11. (if (boundp 'mail-user-agent)
  12. (setq mail-user-agent 'mew-user-agent))
  13. (if (fboundp 'define-mail-user-agent)
  14. (define-mail-user-agent
  15. 'mew-user-agent
  16. 'mew-user-agent-compose
  17. 'mew-draft-send-message
  18. 'mew-draft-kill
  19. 'mew-send-hook))
  20. (when (boundp 'utf-translate-cjk)
  21. (setq utf-translate-cjk t)
  22. (custom-set-variables
  23. '(utf-translate-cjk t)))
  24. (if (fboundp 'utf-translate-cjk-mode)
  25. (utf-translate-cjk-mode 1))
  26. ;;用w3m来读html格式邮件
  27. (setq mew-mime-multipart-alternative-list '("Text/Html" "Text/Plain" "*."))
  28. (condition-case nil
  29. (require 'mew-w3m)
  30. (file-error nil))
  31. (setq mew-use-text/html t)
  32. ;;mail account config
  33. (setq mew-config-alist
  34. '(
  35. ("default"
  36. (pop-server "pop.126.com")
  37. (name "126")
  38. (user "chenbin512")
  39. (mail-domain "126.com")
  40. (pop-auth pass)
  41. (pop-user "chenbin512@126.com")
  42. (smtp-user "chenbin512@126.com")
  43. (smtp-server "smtp.126.com")
  44. )
  45. ("gmail"
  46. (pop-server "127.0.0.1")
  47. (pop-port 9959)
  48. (name "gmail")
  49. (user "chenbin512")
  50. (mail-domain "gmail.com")
  51. (pop-auth pass)
  52. (pop-user "chenbin512@gmail.com")
  53. (smtp-user "chenbin512@gmail.com")
  54. (smtp-server "127.0.0.1")
  55. (smtp-port 4659)
  56. )
  57. ("163"
  58. (pop-server "pop.163.com")
  59. (name "163")
  60. (user "pandachen512")
  61. (mail-domain "163.com")
  62. (pop-auth pass)
  63. (pop-user "pandachen512@163.com")
  64. (smtp-user "pandachen512@163.com")
  65. (smtp-server "smtp.163.com")
  66. )
  67. )
  68. )
  69. ;;设置邮件签名档
  70. (setq mew-signature-file "~/Mail/signature")
  71. (setq mew-signature-as-lastpart t)
  72. (setq mew-signature-insert-last t)
  73. (add-hook 'mew-before-cite-hook 'mew-header-goto-body)
  74. (add-hook 'mew-draft-mode-newdraft-hook 'mew-draft-insert-signature)
  75. ;;设置邮件分类
  76. (setq mew-refile-guess-alist
  77. '(("To:"
  78. ("@126.com" . "+Mail/126")
  79. ("@gmail.com" . "+Mail/gmail")
  80. ("@163.com" . "+Mail/163"))
  81. ("Cc:"
  82. ("@126.com" . "+Mail/126")
  83. ("@gmail.com" . "+Mail/gmail")
  84. ("@163.com" . "+Mail/163"))
  85. (nil . "+inbox")))
  86. (setq mew-refile-guess-control
  87. '(mew-refile-guess-by-alist))
  88. ;;设置邮件显示栏目
  89. (setq mew-summary-form
  90. '(type (10 date) " " (40 from) " " t (0 subj)))
  91. (setq mew-summary-form-extract-rule '(name))

3、配置stunnel4

对于采用SSL/TLS连接的邮件服务器,需要配置stunnel来提供加密连接,例如:gmail

$sudo vim /etc/stunnel/stunnel.conf


点击(此处)折叠或打开

  1. ; Protocol version (all, SSLv2, SSLv3, TLSv1)
  2. sslVersion = SSLv3

  3. ; Some security enhancements for UNIX systems - comment them out on Win32
  4. chroot = /var/lib/stunnel4/
  5. setuid = stunnel4
  6. setgid = stunnel4
  7. ; PID is created inside the chroot jail
  8. pid = /stunnel4.pid

  9. ; Some performance tunings
  10. socket = l:TCP_NODELAY=1
  11. socket = r:TCP_NODELAY=1
  12. ;compression = rle


  13. ; Some debugging stuff useful for troubleshooting
  14. debug = 7
  15. output = /var/log/stunnel4/stunnel.log

  16. ; Use it for client mode
  17. client = yes

  18. ; Service-level configuration

  19. [pop3s]
  20. accept = 995
  21. connect = 110

  22. [imaps]
  23. accept = 993
  24. connect = 143

  25. [ssmtp]
  26. accept = 465
  27. connect = 25

  28. ;;
  29. ;; gmail seting
  30. ;;
  31. [gmail-pops]
  32. accept = 9959
  33. connect = imap.gmail.com:995

  34. [gmail-imaps]
  35. accept = 9939
  36. connect = imap.gmail.com:993

  37. [gmail-ssmtp]
  38. accept = 4659
  39. 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





阅读(4837) | 评论(0) | 转发(0) |
1

上一篇:Shell编程的10个最佳实践

下一篇:没有了

给主人留下些什么吧!~~