前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >用Emacs接收Exchange邮件

用Emacs接收Exchange邮件

作者头像
星哥玩云
发布2022-07-03 16:01:07
1.7K0
发布2022-07-03 16:01:07
举报
文章被收录于专栏:开源部署开源部署

基本思路,首先安装DavMail server版本,将exchange服务转换成标准服务,比如smtp, pop3, imap。

然后使用Emacs的mu4e连接DavMail的imap服务。

如何安装DavMail server请参考我之前的文章,已经做了更新:

DavMail server版配置

因为有了imap服务,可以采用我之前写的使用gnus访问gmail的方式,这样在emacs中就可以收邮件了。不过我决定尝试一种新的方法mu4e. 据说这个是很好的。

安装方法参考

http://www.djcbsoftware.nl/code/mu/mu4e/Installation.html#Installation

offlineimap下载邮件

使用之前需要先用offlineimap通过davmail server将公司邮箱中的邮件下载到本地。主要是需要配置一个文件~/.offlineimaprc

http://www.djcbsoftware.nl/code/mu/mu4e/Gmail-configuration.html#Gmail-configuration

[general] accounts = LeTV maxsyncaccounts = 3

[Account LeTV] localrepository = Local remoterepository = Remote

[Repository Local] type = Maildir localfolders = ~/mail

[Repository Remote]type = IMAPremotehost = dav_mail_serverremoteport = 1143remoteuser = your_account, no @remotepass =

注意

1. 公司邮箱中自定义目录最好没有中文名称,否则运气不好会报错

2. 要创建本地目录 ~/mail

3. maxcoinnections 只能设置为1, 大于1的我都遇到报错,只能慢慢下载了

好,然后在~目录下,运行命令

offlineimap

我的邮件比较多,1万多封,5.1GB,等了一个晚上终于下载完成了。

索引本地邮件

好,现在邮件都在本地~/mail目录下了,来建立索引吧。

$ mu index -m ~/mail indexing messages under /home/dean/mail [/home/dean/.mu/xapian] - processing mail; processed: 11625; updated/new: 11625, cleaned-up: 0 mu: ignoring because bigger than 50000000 bytes: /home/dean/mail/INBOX/cur/1416665450_0.29886.dean-Aspire-V7-481G,U=5238,FMD5=7e33429f656f1e6e9d79b29c3f82c57e:2,S / processing mail; processed: 14550; updated/new: 14550, cleaned-up: 0 mu: ignoring because bigger than 50000000 bytes: /home/dean/mail/INBOX/cur/1416671339_0.29886.dean-Aspire-V7-481G,U=9646,FMD5=7e33429f656f1e6e9d79b29c3f82c57e:2,S / processing mail; processed: 23550; updated/new: 23550, cleaned-up: 0 mu: ignoring because bigger than 50000000 bytes: /home/dean/mail/Sent/cur/1416682079_0.29886.dean-Aspire-V7-481G,U=1719,FMD5=7f8c0283f16925caed8e632086b81b9c:2,S / processing mail; processed: 24750; updated/new: 24750, cleaned-up: 0 cleaning up messages [/home/dean/.mu/xapian] | processing mail; processed: 24807; updated/new: 0, cleaned-up: 0 elapsed: 1 second(s), ~ 24807 msg/s / processing mail; processed: 24807; updated/new: 0, cleaned-up: 0 elapsed: 191 second(s), ~ 129 msg/s

配置emacs mu4e

在~/.emacs.d/init.el文件中,添加如下配置:

;; the exact path may differ -- check it (add-to-list 'load-path "/usr/local/share/emacs/site-lisp/mu4e") (require 'mu4e)

(setq mu4e-maildir "~/mail") (setq mu4e-drafts-folder "/Drafts") (setq mu4e-sent-folder  "/Sent") (setq mu4e-trash-folder  "/Trash")

;; don't save message to Sent Messages, Gmail/IMAP takes care of this (setq mu4e-sent-messages-behavior 'delete)

;; setup some handy shortcuts ;; you can quickly switch to your Inbox -- press ``ji'' ;; then, when you want archive some messages, move them to ;; the 'All Mail' folder by pressing ``ma''.

(setq mu4e-maildir-shortcuts       '( ("/INBOX"              . ?i)         ("/[LeTV].Sent Mail"  . ?s)         ("/[LeTV].Trash"      . ?t)         ("/[LeTV].All Mail"    . ?a)))

;; allow for updating mail using 'U' in the main view: (setq mu4e-get-mail-command "offlineimap")

;; something about ourselves (setq  user-mail-address "chenshu@letv.com"  user-full-name  "Dean Chen"  message-signature  (concat   "Dean Chen\n"   "Email: chenshu@letv.com\n"   "Blog: blog.csdn.net/csfreebird\n"   "Big Data Tech Director of LeTV.com"   "\n"))

;; sending mail -- replace USERNAME with your gmail username ;; also, make sure the gnutls command line utils are installed ;; package 'gnutls-bin' in Debian/Ubuntu

(require 'smtpmail)

;; alternatively, for emacs-24 you can use:(setq message-send-mail-function 'smtpmail-send-it    smtpmail-stream-type 'starttls    smtpmail-default-smtp-server "

;; don't keep message buffers around (setq message-kill-buffer-on-exit t)

;;---------------------------------------------------------- ;; ---- END Email client ---- ;;---------------------------------------------------------- (put 'erase-buffer 'disabled nil)

然后启动emacs, M-x 后运行命令: mu4e,看到如下画面:

用Emacs接收Exchange邮件
用Emacs接收Exchange邮件
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档