配置 Gnus 收发 Gmail

本文介绍了如何配置Gnus来收发Gmail邮件,重点在于设置".gnus.el"文件和管理gmail的帐号信息在".authinfo"文件中的步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

        刚换了一家公司,开发语言没变,只是开发平台变了。 原来只是好奇并对linux有点兴趣,上班windows,下班ubuntu。
后来感觉工作中用不上的东西,自己的学习热情好像就不是很足。于是趁跳槽的机会转个型,耗了些时间,不过好在终于找到了一个还算不错的。
        新公司工作时沟通用的是 E-mail 的方式,每人配了一台Linux和一个windows的笔记本,写代码就用linux,一般发邮件
就用windows上的outlook来发。正好最近也在学习Emacs,其中的Gnus就有收发E-mail的功能,如果能在linux直接收发邮件的话,肯定能提高
不少工作效率。
        于是就有了这篇文章,说是原创其实也不是啦,就是自己这边搜一点,那边找一下,东拼西凑,多试了几次,发现可以用了,这就发了上来。

下面的配置代码放在 ".gnus.el" 中

;; My Gnus Configuration

;; set your name and email address 
(setq user-full-name "Bright.Chen"
      user-mail-address "Bright.Chen@yourcompany.com")

;; fetch news from newsgroup
;; (setq gnus-select-method '(nntp "news.gmane.org"))

;; set "nnml" method and POP server configuration 
;; so that we could retrieve emails from POP server
(setq gnus-select-method '(nnml "pop-mail"))

;; add this to be able to list all gmail labels
(setq gnus-ignored-newsgroups "")

;; to be able to search within your gmail/imap mail
;; (require 'nnir)

;; add this to configure gmail imap 
(add-to-list 'gnus-secondary-select-methods '(nnimap "gmail"
                                             (nnimap-address "imap.gmail.com")
                                             (nnimap-server-port 993)
                                             (nnimap-stream ssl)
				          ;; (nnir-search-engine imap)
				             (nnimap-authinfo-file "~/.authinfo")))

;; send mails using gmail's smtp server
(setq 
      ;; message-send-mail-function 'smtpmail-send-it
         smtpmail-starttls-credentials '(("smtp.gmail.com" 587 nil nil))
         smtpmail-auth-credentials '(("smtp.gmail.com" 587 "Bright.Chen@gmail.com" nil))      
         smtpmail-default-smtp-server "smtp.gmail.com"      
         smtpmail-smtp-server "smtp.gmail.com"
         smtpmail-smtp-service 587      
      ;; smtpmail-local-domain "yourcompany.com"
         )

;; function used to send mail
(setq send-mail-function 'smtpmail-send-it
      ;; message-send-mail-function 'smtpmail-send-it)

;; show debug info where sending mails failed 
(setq smtpmail-debug-info t      
      smtpmail-debug-verb t)

;; load smtpmail library
(require 'smtpmail)

下面是gmail的帐号信息,放在配置文件 ".authinfo" 中

machine imap.gmail.com login Bright.Chen@gmail.com password yourpassword port 993
machine smtp.gmail.com loginBright.Chen@gmail.com password yourpassword port 587


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值