当前在 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 文件:
机器 mail.example.org 端口 25 登录 myuser 密码 mypassword
并将以下内容添加到我的 init.el
文件中:
(setq smtpmail-stream-type 'ssl)
(setq smtpmail-smtp-server "smtp.gmail.com")
(setq smtpmail-smtp-service 465)
(如第二个链接所示,即 super 用户链接。)
但是当我运行 M-x rmail
时,它仍然连接到我计算机的本地电子邮件地址,而不是我的 gmail。我需要设置什么才能登录和读取/写入电子邮件? (如果您可以包含击键,那也会非常有帮助。)
我正在运行 ubuntu 12.04,如果这有什么区别的话。
最佳答案
在尝试了多种方法之后,我现在使用 offlineimap 在我的计算机和 Google 服务器之间同步消息。然后Gnus从本地机器读取消息。 Postfix用于将消息发送到gmail smtp服务器。此设置的优点:在 gnus 中读取/发送电子邮件不涉及等待服务器(快速),可以在离线时读取/发送电子邮件(再次在线时传递到服务器)。如果您更喜欢使用 RMail,则可以代替 gnus。
这就是我在 ubuntu 13.10 上所做的。
offlineimap,定期运行将邮件放入 ~/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” 用户邮件地址设置为“YourName@gmail.com”
最棘手的事情是设置 Postfix,描述得很清楚 here :
解决问题的进一步评论:
程序offlineimap由文件~/.offlineimaprc控制。当offineimap运行时,它会将信息保存在目录~/.offlineimap中。您可以阅读文档来解释这一切是如何工作的。
回复:发送邮件:事实上,我以前是直接从 emacs 发送邮件的。这涉及到摆弄很多事情。事实证明,让 postfix 处理它要容易得多。例如,我使用几个不同的电子邮件帐户从 Gnus 发送邮件;我现在通过发布样式让 gnus 了解这一点,并让 postfix 关心哪个地址应该发送到哪个服务器以及如何发送。
关于email - 在 emacs 24 中读取电子邮件(来自 gmail),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20979918/