在尝试了很多方法之后,我现在使用 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 担心哪个地址应该去哪个服务器,以及如何去。