;Global (setq gnus-startup-file "~/.newsrc" gnus-default-directory "~/mail/" gnus-home-directory "~/mail/" gnus-article-save-directory "~/mail/save/" gnus-kill-files-directory "~/mail/trash/" gnus-agent-directory "~/mail/agent/" gnus-cache-directory "~/mail/cache/" mail-source-directory "~/mail/incoming/" nnmail-message-id-cache-file "~/mail/.nnmail-cache" nnml-newsgroups-file "~/mail/newsgroup" message-directory "~/mail/" message-auto-save-directory "~/mail/drafts/") (setq gnus-save-newsrc-file nil gnus-read-newsrc-file nil gnus-use-dribble-file nil gnus-interactive-exit nil gnus-save-killed-list nil) ;Get (setq gnus-select-method '(nnml "")) (setq mail-sources '((imap :server "imap.gmail.com" :port 993 :user "xxx@gmail.com" :password "secret" :authentication 'login :stream ssl :fetchflag "\\Seen") (imap :server "imap.gmail.com" :port 993 :user "yyy@gmail.com" :password "secret" :authentication 'login :stream ssl :fetchflag "\\Seen"))) (setq nnmail-split-methods '(("Emacs" "^To:.*help-gnu-emacs\\|^Cc:.*help-gnu-emacs") ("Kernel-zh" "^To:.*Linux-kernel\\|^Cc:.*Linux-kernel") ("Sawfish" "^To:.*sawfish-list\\|^Cc:.*sawfish-list") ("Living" "^To:.*xxx") ("Working" "^To:.*yyy") ("NotHere" ""))) ;Group (setq gnus-group-line-format "\t%M%S%p%P%4y / %4t: %B%*%(%-10g%)%O\t%ud\n" gnus-check-new-newsgroups nil) (add-hook 'gnus-select-group-hook 'gnus-group-set-timestamp) (defun gnus-user-format-function-d (headers) (let ((time (gnus-group-timestamp gnus-tmp-group))) (if time (format-time-string "(%d/%m/%Y %H:%M)" time) ""))) (setq gnus-parameters '(("Emacs" (subscribed . t) (expiry-wait . 7) (broken-reply-to . t) (to-address . "help-gnu-emacs@gnu.org") (admin-address . "help-gnu-emacs-request@gnu.org") (posting-style (address "yyy@gmail.com") (signature "Regards,\nyyy"))) ("Sawfish" (subscribed . t) (expiry-wait . 15) (broken-reply-to . t) (to-address . "sawfish-list@gnome.org") (admin-address . "sawfish-list-request@gnome.org") (posting-style (address "yyy@gmail.com") (signature "Regards,\nyyy"))) ("Kernel-zh" (subscribed . t) (expiry-wait . 7) (broken-reply-to . t) (to-address . "Linux-kernel@kernel-zh.org") (admin-address . "Linux-kernel-request@kernel-zh.org") (posting-style (name "yyy") (address "yyy@gmail.com") (signature "yyy"))) ("Living" (auto-expire . t) (posting-style (name "xxx") (address "xxx@gmail.com") (signature "祝一切顺利,\n xxx"))) ("Working" (auto-expire . t) (posting-style (name "yyy") (address "yyy@gmail.com") (signature "Regards,\nyyy"))))) ;Summary (setq gnus-face-0 'gnus-server-offline gnus-face-1 'gnus-server-agent gnus-face-2 'gnus-server-opened gnus-user-date-format-alist '(((gnus-seconds-today) . "Today %2H:%2M") (t . "%b %d %2H:%2M")) gnus-summary-line-format "%U%R%1{|%}%2{%-10&user-date;%}%1{|%}%0{%-24,24n%}%1{|%}%B%s\n" gnus-show-threads t gnus-thread-hide-subtree t gnus-thread-sort-functions '((not gnus-thread-sort-by-number) (not gnus-thread-sort-by-date)) gnus-article-sort-functions '((not gnus-article-sort-by-number) (not gnus-article-sort-by-date)) gnus-sum-thread-tree-root "* " gnus-sum-thread-tree-single-indent "* " gnus-sum-thread-tree-leaf-with-other "|-> " gnus-sum-thread-tree-vertical "|" gnus-sum-thread-tree-single-leaf "`-> ") ;Message (setq gnus-visible-headers "From:\\|Subject:\\|Date:\\|Organization:\\|To:\\|Cc:\\|Reply-To:" message-fill-column nil message-kill-buffer-on-exit t gnus-treat-display-smileys nil gnus-treat-display-face nil mm-inline-large-images t) (setq gnus-default-charset 'utf-8 mm-coding-system-priorities '(utf-8) gnus-group-name-charset-group-alist '((".*" . chinese-iso-8bit)) gnus-summary-show-article-charset-alist '((1 . utf-8) (2 . chinese-iso-8bit) (3 . gbk) (4 . big5)) gnus-newsgroup-ignored-charsets '(unknown-8bit x-unknown iso-8859-1)) (eval-after-load "mm-decode" '(progn (add-to-list 'mm-discouraged-alternatives "text/html") (add-to-list 'mm-discouraged-alternatives "text/richtext"))) ;Send (setq message-sendmail-envelope-from 'header) (setq send-mail-function 'smtpmail-send-it message-send-mail-function 'smtpmail-send-it) (setq smtpmail-default-smtp-server "smtp.gmail.com" smtpmail-smtp-server "smtp.gmail.com" smtpmail-smtp-service 587 smtpmail-auth-credentials '(("smtp.gmail.com" 587 "yyy@gmail.com" "secret")) smtpmail-starttls-credentials '(("smtp.gmail.com" 587 nil nil))) (defun change-smtpmail-auth-credentials () "Change the smtpmail-starttls-credentials according to current from line." (save-excursion (let ((from (save-restriction (message-narrow-to-headers) (message-fetch-field "from")))) (if (string-match "xxx@gmail.com" from) (setq smtpmail-auth-credentials '(("smtp.gmail.com" 587 "xxx@gmail.com" "secret"))) (setq smtpmail-auth-credentials '(("smtp.gmail.com" 587 "yyy@gmail.com" "secret"))))))) (add-hook 'message-setup-hook 'change-smtpmail-auth-credentials)