在 emacs 24 中阅读电子邮件(来自 gmail) [英] Reading email (from gmail) in emacs 24

查看:34
本文介绍了在 emacs 24 中阅读电子邮件(来自 gmail)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前在 emacs 24 中查看和发送电子邮件的权威方式是什么?

What's the current authoritative way to check and send email in emacs 24?

我检查了以下 SO 链接:

I've checked the following SO links:

  1. 在 Emacs VM 中设置 Gmail
  2. https://superuser.com/questions/476714/how-to-configure-emacs-smtp-for-using-a-secure-server-gmail
  3. 我应该使用哪个 Emacs 邮件包?

并了解包 smtpmail, rmail,以及一个 .authinfo 文件.

And understand the packages smtpmail, rmail, are involved, as well as an .authinfo file.

我已经创建了一个 .authinfo 格式的文件:

I have created an .authinfo file of the form:

<代码>机器 mail.example.org 端口 25 登录 myuser 密码 mypassword

并将以下内容添加到我的 init.el 文件中:

And have added the following to my init.el file:

(setq smtpmail-stream-type 'ssl)
(setq smtpmail-smtp-server "smtp.gmail.com")
(setq smtpmail-smtp-service 465)

(作为第二个链接,超级用户说.)

(As the second link, the Superuser one, said.)

但是当我运行 M-x rmail 时,它仍然连接到我计算机的本地电子邮件地址,而不是我的 gmail.我需要设置什么才能登录和读/写电子邮件?(如果您可以包含击键,那也将非常有帮助.)

But when I run M-x rmail, it still connects to my computer's local email address, rather than my gmail. What do I need to set up to login and read/write email? (If you could include keystrokes, that would also be super helpful.)

如果这有什么不同,我正在运行 ubuntu 12.04.

I'm running ubuntu 12.04 if that makes any difference.

推荐答案

在尝试了很多方法之后,我现在使用 offlineimap 在我的机器和 google 服务器之间同步消息.Gnus 然后从本地机器读取消息.Postfix 用于向 gmail smtp 服务器发送消息.这种设置的优点:阅读/发送电子邮件不涉及在 gnus 中等待服务器(快速),可以在离线时阅读/发送电子邮件(再次在线时传递给服务器).如果您更喜欢使用 RMail,则可以代替 gnus.

After trying many ways, I now use offlineimap to sync messages between my machine and the google server. Gnus then reads messages from the local machine. Postfix is used to send messages to the gmail smtp server. Virtues of this setup: reading/sending email does not involve waiting for servers while in gnus (fast), can read/send email while offline (passed to server when online again). If you preferred to use RMail, you could instead of gnus.

这就是我在 ubuntu 13.10 上所做的.

This is what I do on ubuntu 13.10.

offlineimap,定期运行将邮件放入~/Maildr/Gmail

offlineimap, run periodically puts mail into ~/Maildr/Gmail

~/.offlineimaprc 的内容:

contents of ~/.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 读取邮件

gnus reads mail from ~/Maildir/Gmail

在 emacs 中,变量 gnus-home-directory 设置为~/文件/gnus".~/Documents/gnus/.gnus"的内容:

In emacs, the variable gnus-home-directory is set to "~/Documents/gnus". Contents of "~/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"

Sending mail: emacs configuration variables: mail-user-agent is set to 'gnus-user-agent send-mail-function is set to 'sendmail-send-it user-mail-address is set to "YourName@gmail.com"

最棘手的事情是设置 Postfix,这在这里有清楚的描述:

Trickiest thing is setting up Postfix, that is clearly described here:

解决问题的进一步评论:

Further comments to address questions:

程序offlineimap由文件~/.offlineimaprc控制.offineimap 运行时,会将信息保存在~/.offlineimap 目录中.您可以阅读文档以了解所有工作原理.

The program offlineimap is controlled by the file ~/.offlineimaprc. When offineimap runs, it will keep information in the directory ~/.offlineimap. You can read the docs for explanation of how that all works.

Re: 发送邮件:其实我以前是直接从emacs 发送邮件的.这涉及摆弄许多事情.事实证明,让 postfix 处理它要容易得多.例如,我在 Gnus 中使用多个不同的电子邮件帐户发送邮件;我现在通过 post-styles 让 gnus 知道这一点,让 postfix 担心哪个地址应该去哪个服务器,以及如何去.

Re: sending mail: In fact, I used to do send mail directly from emacs. This involved fiddling with a number of things. It turned out to be much easier to just let postfix handle it. For example, I use several different email accounts to send mail from in Gnus; I now let gnus know about this via posting-styles, and let postfix worry about which address should go to which server, and how.

这篇关于在 emacs 24 中阅读电子邮件(来自 gmail)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆