use gnus gmail
Put the following in your ~/.gnus file and replace “user@gmail.com” with your email address:
(setq gnus-select-method
'(nnimap "gmail"
(nnimap-address "imap.gmail.com")
(nnimap-server-port 993)
(nnimap-stream ssl)))
(setq message-send-mail-function 'smtpmail-send-it
smtpmail-starttls-credentials '(("smtp.gmail.com" 587 nil nil))
smtpmail-auth-credentials '(("smtp.gmail.com" 587
"user@gmail.com" nil))
smtpmail-default-smtp-server "smtp.gmail.com"
smtpmail-smtp-server "smtp.gmail.com"
smtpmail-smtp-service 587
gnus-ignored-newsgroups "^to\\.\\|^[0-9. ]+\\( \\|$\\)\\|^[\"]\"[#'()]")
Put the following in your ~/.authinfo file and replace “user@gmail.com” with your email address and replace “secret” with your password—or your application-specific password:
machine imap.gmail.com login user@gmail.com password secret port 993
machine smtp.gmail.com login user@gmail.com password secret port 587
When sending your first email from gnus, you might get a STARTTLS error. If you’re using homebrew in Mac OS X, you can install the necessary package with brew install gnutls.
You can find more information in the following sections.
Run M-x gnus and enjoy.