在 emacs 24 中阅读电子邮件(来自 gmail)
Posted
技术标签:
【中文标题】在 emacs 24 中阅读电子邮件(来自 gmail)【英文标题】:Reading email (from gmail) in emacs 24 【发布时间】:2014-01-25 14:59:50 【问题描述】:目前在 emacs 24 中检查和发送电子邮件的权威方式是什么?
我检查了以下 SO 链接:
-
Setup for Gmail in Emacs VM
https://superuser.com/questions/476714/how-to-configure-emacs-smtp-for-using-a-secure-server-gmail
Which Emacs mail package should I use?
并了解所涉及的包smtpmail、rmail,以及.authinfo file。
我创建了一个 .authinfo 文件,格式为:
machine mail.example.org port 25 login myuser password mypassword
并将以下内容添加到我的init.el
文件中:
(setq smtpmail-stream-type 'ssl)
(setq smtpmail-smtp-server "smtp.gmail.com")
(setq smtpmail-smtp-service 465)
(作为第二个链接,超级用户一说。)
但是当我运行M-x rmail
时,它仍然连接到我计算机的本地电子邮件地址,而不是我的 gmail。我需要设置什么才能登录和读/写电子邮件? (如果您可以包括击键,那也将非常有帮助。)
如果这有什么不同的话,我正在运行 ubuntu 12.04。
【问题讨论】:
SMTP 是用于发送邮件的协议,而不是用于读取的协议(这将是 IMAP 或 POP3)。这里有一些建议:superuser.com/questions/69504/getting-gmail-in-emacs 【参考方案1】:在尝试了很多方法之后,我现在使用 offlineimap 在我的机器和谷歌服务器之间同步消息。 Gnus 然后从本地机器读取消息。 Postfix 用于向 gmail smtp 服务器发送消息。此设置的优点:在 gnus 中读取/发送电子邮件不涉及等待服务器(快速),可以在离线时读取/发送电子邮件(再次在线时传递给服务器)。如果你更喜欢使用 RMail,你可以代替 gnus。
这就是我在 ubuntu 13.10 上所做的。
离线imap,定期运行将邮件放入~/Maildr/Gmail
~/.offlineimaprc 的内容:
[general]
# List of accounts to be synced, separated by a comma.
accounts = Gmail
maxsyncaccounts = 2
[Account Gmail]
# Identifier for the local repository; e.g. the maildir to be synced via IMAP.
localrepository = Gmail-local
# Identifier for the remote repository; i.e. the actual IMAP, usually non-local.
remoterepository = Gmail-remote
# Status cache. Default is plain, which eventually becomes huge and slow.
status_backend = sqlite
[Repository Gmail-local]
type = Maildir
localfolders = ~/Maildir/Gmail
[Repository Gmail-remote]
type = Gmail
remoteuser = YourName@gmail.com
remotepass = YourPass
folderfilter = lambda foldername: foldername in ['INBOX', 'Dev']
# Necessary as of OfflineIMAP 6.5.4
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
gnus 从 ~/Maildir/Gmail 读取邮件
在 emacs 中,变量 gnus-home-directory 设置为 “~/文档/gnus”。 “~/Documents/gnus/.gnus”的内容:
(setq gnus-select-method
'(nntp "localhost")) ; I also read news in gnus; it is copied to my local machine via **leafnode**
(setq gnus-secondary-select-methods
'((nnmaildir "GMail" (directory "~/Maildir/Gmail")) ; grab mail from here
(nnfolder "archive"
(nnfolder-directory "~/Documents/gnus/Mail/archive") ; where I archive sent email
(nnfolder-active-file "~/Documents/gnus/Mail/archive/active")
(nnfolder-get-new-mail nil)
(nnfolder-inhibit-expiry t))))
发送邮件: emacs 配置变量: mail-user-agent 设置为 'gnus-user-agent send-mail-function 设置为 'sendmail-send-it user-mail-address 设置为“YourName@gmail.com”
最棘手的事情是设置 Postfix,这在 here 中有明确描述:
进一步解决问题的方法:
offlineimap 程序由文件~/.offlineimaprc 控制。 offineimap 运行时,会将信息保存在目录~/.offlineimap 中。您可以阅读文档以了解所有工作原理。
Re: 发送邮件:其实我以前是直接从 emacs 发送邮件的。这涉及摆弄许多事情。事实证明,让 postfix 处理它要容易得多。例如,我使用几个不同的电子邮件帐户从 Gnus 中发送邮件;我现在通过发布样式让 gnus 知道这一点,让 postfix 担心哪个地址应该去哪个服务器,以及如何去。
【讨论】:
在此设置中是否有使用 Postfix 的具体原因?为什么不用smptmail-send-it
直接发送邮件到GMail呢?
我强烈建议尝试isync 作为offlineimap 的替代品。它要快得多。
你有一个要点或其他东西来展示发布风格的工作原理吗?我想在 Gnus 中设置三个 Gmail 帐户。我已经让 Offlineimap 为所有三个工作,只需要让 Gnus 知道它们。
肖恩,如果您提出问题,我可以写一些详细的内容。简而言之:每个 gmail 帐户都是 gnus 中的一个主题。您可以设置主题的发布样式以指定详细信息。示例:((posting-style (address "address_one@gmail.com") (organization "Bad at Best")))
【参考方案2】:
我不确定有没有“当前权威的方式”?
请务必查看http://www.emacswiki.org/emacs/CategoryMail
mu4e 对我来说听起来很不错,但由于我从来没有时间为自己实际配置这种东西,所以我无法提出任何建议。
http://box.matto.nl/emacsgmail.html(对于Wanderlust 客户端)当然是相关的。
【讨论】:
【参考方案3】:确实 mu4e 是我的选择:http://www.djcbsoftware.nl/code/mu/mu4e.html
edit:我还尝试了notmuchmail 并使用mbsync
(isync
Debian 软件包)获取电子邮件。当offlineimap 需要一个配置步骤时,mbsync 获得了开箱即用的证书支持。有人说它更可靠。我更喜欢 notmuch 显示的对话。
mu
shell 命令,可以很好地在终端上找到邮件http://www.djcbsoftware.nl/code/mu/
所以 mu4e 使用 offlineimap 获取邮件,mu
对其进行索引,然后 mu4e 将其显示在 emacs 中。
甚至可以使用 org-mode 编写富文本邮件!它仍然是实验性的,但 here's an example 关于如何包含数学公式和用 python 编写的绘图。
ps:
http://wikemacs.org/index.php/Category:Email 和 mu4e 扩展列表:http://wikemacs.org/wiki/Mu4e(通知、联系完成、日程安排电子邮件……)【讨论】:
【参考方案4】:和@Ehvince 一样,我也推荐mu4e,尽管我现在只使用Gnus。 Mu4e 非常容易设置/使用,方便,快捷,搜索/排序能力很好。
虽然 Wanderlust 有效,但我发现它在安装方面有点麻烦。设置完成后,我为键绑定创建了一个备忘单,并在附近放置了一段时间。我不确定它是否得到积极维护。
我听说过 Mew,但从未使用过。一个好处是它似乎可以直接作为一个包安装。
我回到 Gnus 是因为它与 Emacs 捆绑在一起,不需要额外的软件。我当前的设置包括:Mairix(用于搜索)、OfflineImap(用于获取邮件)。和@Jeffrey 一样,我也在 Gnus 中阅读新闻。
【讨论】:
【参考方案5】:正如其他人所说,没有一种“权威”的方式可以做到这一点。多年来,我使用过 VM、Gnus、MH-E 和 Wanderlust,更不用说大量非 emacs 邮件客户端了。
我很想尝试 mu4e,基于我听到的所有关于它的好消息,但使用 offlineimap 似乎违背了 IMAP 的目的,至少对于使用多台计算机而言。我真的不想在我的工作笔记本电脑、家用笔记本电脑和台式机上同步电子邮件的本地副本。 (实际上,我的桌面上确实有一个 MH 格式的本地存储库,所以我可以将其转换为 Maildir,但我的大部分邮件阅读都是在笔记本电脑上完成的。)
我目前正在使用 Gnus 直接与 IMAP 服务器通信。获取消息时它有时会暂停,但总的来说,它非常敏感。我发现 Wanderlust 很难设置,而且一旦启动就很慢。
【讨论】:
以上是关于在 emacs 24 中阅读电子邮件(来自 gmail)的主要内容,如果未能解决你的问题,请参考以下文章