1.Download stunnel installer and openssl
2.Install them, edit stunnel.conf:
output = stunnel.log
client = yes
[SMTP Gmail]
accept = 127.0.0.1:466
connect = smtp.gmail.com:465
[IMAPS Gmail]
accept = 127.0.0.1:996
connect = imap.gmail.com:993
3.Run stunnel sevice start, so it can run in backgroud
4.Edit .gnus(default configure file)
(defun fs-change-smtp ()
"Change the SMTP server according to the current from line."
(save-excursion
(let ((from
(save-restriction
(message-narrow-to-headers)
(message-fetch-field "from"))))
(message "From is `%s', setting `smtpmail-smtp-server' to `%s'"
from
(cond
((string-match "xxx@gmail.com" from)
;; Use stmp-auth
(message "Using smtp-auth")
;; Sending mail
(setq message-send-mail-function 'smtpmail-send-it)
(setq smtpmail-starttls-credentials '(("127.0.0.1" 466 nil nil)))
(setq smtpmail-auth-credentials '(("127.0.0.1" 466 "xxx@gmail.com" nil)))
(setq smtpmail-default-smtp-server "127.0.0.1")
(setq smtpmail-smtp-server "127.0.0.1")
(setq smtpmail-smtp-service 466)
)
;;((string-match "xxx@gmail.com" from)
;; Use local sendmail
;; (message "Using local sendmail")
;;(setq message-send-mail-function `message-send-mail-with-sendmail))
(t
(error
(concat "Don't know which mail server to use for "
from))))))))
(add-hook 'message-setup-hook 'fs-change-smtp)
(setq user-mail-address "xxx@gmail.com")
(setq user-full-name "xxx")
(setq gnus-select-method '(nnimap "imap.gmail.com"
(nnimap-address "127.0.0.1")
(nnimap-server-port 996)
))
(add-hook 'gnus-topic-mode-hook 'gnus-topic-mode)
5.M+x gnus, That's it!
0 评论: (+add yours?)
Post a Comment