help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help with Gnus and Gmail


From: Wang Lei
Subject: Re: Help with Gnus and Gmail
Date: Mon, 12 Oct 2009 20:51:27 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Mario Castelán Castro <mariocastelancastro@gmail.com> writes:

> october 10th 2009 for help-gnu-emacs
>
> Hi all, i just are trying to read mail in emacs, i are trying Gnus for
> that, after do what http://www.emacswiki.org/emacs/GnusGmail says i
> have the following in my .emacs:
>
> (require 'gnus)
> (setq user-mail-address "mariocastelancastro@gmail.com")
> (setq user-full-name "Mario Xerxes Castelan Castro")
> (add-to-list 'gnus-secondary-select-methods
>            '(nnimap "gmail"
>                     (nnimap-address "imap.gmail.com")
>                     (nnimap-server-port 993)
>                     (nnimap-stream
>                     ssl)))
>
> When i open Gnus with M-x gnus it says "unable to open server
> nntp+news go offline?", i type n, later "nntp (news) open error:
> ''. Continue?", i type y, "Gnus auto-save file exist.  Do you want to
> read it?" i type n. Then a buffer than says: "*: nndraft:queue :
> nndraft:drafts" appears and i are unable to read mail or do
> anyting. ¿Wath i are doing wrong?.
Hi, Mario.

I think "unable to open server nntp+news go offline" because nntp+news is the 
default method of gnus. Check out your variable gnus-select-method. If you 
haven't subscribed newsgroup and want gnus to get mail as default. You can try

(setq gnus-select-method '(nnml ""))

I use the nnml as the backend. This is part of my config, hope useful.

(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")))

And, this is the full configuration.

;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)
>
> Thanks in advance.

-- 
Regards,
Lei

reply via email to

[Prev in Thread] Current Thread [Next in Thread]