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

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

问题描述



我检查了以下SO链接:


  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 file



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




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



并将以下内容添加到我的 init.el file:

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

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



但是我运行 Mx rmail ,它仍然连接到我的电脑的本地电子邮件地址,而不是我的Gmail。我需要设置登录和阅读/写入电子邮件? (如果可以包括击键,那也是非常有用的)。



如果有任何差异,我正在运行ubuntu 12.04。

解决方案

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



这是我在ubuntu 13.10上所做的。



offlineimap,定期运行邮件到〜/ Maildr / Gmail



〜/ .offlineimaprc的内容:

  [general] 
#要同步的帐户列表,用逗号分隔。
account = Gmail
maxsyncaccounts = 2

[帐户Gmail]
#本地存储库的标识符;例如maildir将通过IMAP进行同步。
localrepository = Gmail-local
#远程存储库的标识符;即实际的IMAP,通常是非本地的。
remoterepository = Gmail-remote
#状态缓存。默认是平原,最终变得巨大而缓慢。
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:['INBOX','Dev']中的foldername
#必需的OfflineIMAP 6.5.4
sslcacertfile = /etc/ssl/certs/ca-certificates.crt

gnus从〜/ Maildir / Gmail中读取邮件



在emacs中,设置了变量 gnus-home-directory
〜/ Documents / gnus。 〜/ Documents / gnus / .gnus的内容:

 (setq gnus-select-方法
'(nntplocalhost));我也读了一个消息在gnus;它通过** leafnode **

(setq gnus-secondary-select-methods
'((nnmaildirGMail(目录〜/ Maildir / Gmail)复制到我的本地机器));从这里获取邮件
(nnfolderarchive
(nnfolder-directory〜/ Documents / gnus / Mail / archive);我存档发送电子邮件
(nnfolder-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,这是清楚描述的这里



解决问题的进一步意见:



程序 offlineimap 由文件〜/ .offlineimaprc 控制。当 offineimap 运行时,它会将信息保存在目录〜/ .offlineimap 中。你可以阅读文档,了解这一切的工作原理。



Re:发送邮件:其实我以前从emacs直接发送邮件。这涉及到了一些事情。原来,让Postfix处理它更容易。例如,我使用几个不同的电子邮件帐户从Gnus发送邮件;我现在让gnus通过发布样式知道这一点,并让postfix担心哪个地址应该去哪个服务器,以及如何。


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

I've checked the following SO links:

  1. Setup for Gmail in Emacs VM
  2. https://superuser.com/questions/476714/how-to-configure-emacs-smtp-for-using-a-secure-server-gmail
  3. Which Emacs mail package should I use?

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

I have created an .authinfo file of the form:

machine mail.example.org port 25 login myuser password mypassword

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.)

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.)

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

解决方案

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.

This is what I do on ubuntu 13.10.

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

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 reads mail from ~/Maildir/Gmail

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))))

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"

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

Further comments to address questions:

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: 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中阅读电子邮件(来自gmail)24的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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