3

I'm trying to set up Gnus to use both my gmail accounts but I can only ever get one at a time to show up in the list of folders.

(setq gnus-select-method '(nnimap "[email protected]"
                            (nnimap-address "secure.emailsrvr.com")
                            (nnimap-server-port 993)
                            (nnimap-stream ssl)))

(setq gnus-secondary-select-methods
      '((nnimap "[email protected]"
                (nnimap-address "imap.gmail.com")
                (nnimap-server-port 993)
                (nnimap-stream ssl))
        (nnimap "[email protected]"
                (nnimap-address "imap.gmail.com")
                (nnimap-server-port 993)
                (nnimap-stream ssl))))

That is the relevant portions of my .gnus file. It prompts me for three username passwords on startup. After I enter all three, I can access my work account and the gmail account that I enter the creds for second. This is really annoying! Any ideas?

3 Answers 3

3

Use 'foreign' servers instead of secondary servers. I have gnus set up as follows:

(setq gnus-select-method '(nntp "127.0.0.1"))

To set up the foreign server, go to your Gnus Group buffer and hit the '^' key to go to the server list. Here you can add a new "server", which can be an alias for a real server, by hitting 'a'. For example, I have a server defined with the following attributes:

(nnimap "foobar"
    (nnimap-address "192.168.1.101")
    (nnimap-server-port 143)
    (nnimap-list-pattern
     ("INBOX" "*"))
    (nnimap-stream network)
    (nnimap-authenticator login)
    (nnimap-authinfo-file "~/.authinfo")
    (nnimap-expunge-on-close always)
    (gnus-check-new-newsgroups nil))

I can add a second one, with similar attributes:

(nnimap "baz"
    (nnimap-address "192.168.1.101")
    (nnimap-server-port 143)
    (nnimap-list-pattern
     ("INBOX" "*"))
    (nnimap-stream network)
    (nnimap-authenticator login)
    (nnimap-expunge-on-close never)
    (nnimap-authinfo-file "~/.authinfo")
    (gnus-check-new-newsgroups nil))

in my ~/.authinfo file I have:

machine baz login bazzy.mcbaz force yes port 143
machine foobar login foobar password FooB@r force yes port 143

So one of them has the password and one doesn't. Also, the authinfo file defines what the login ID is.

2
  • Where you say "For example, I have a server defined with the following attributes:" can you be more specific. Where have you defined these and using what list?
    – RichieHH
    Jul 27, 2010 at 15:38
  • @richard: while on the screen where you went with ^, hit e. You'd be given the chance to set-up the server. Just make sure you never delete .newsrc.eld because changes are saved there.
    – user69275
    Feb 26, 2011 at 13:24
1

(Sorry for my delay in answering.) It seems the accepted answer doesn't solve the problem of saving both passwords. That seems a limitation of ~/.authinfo which stores the passwords. To get around that, create different hostnames and use your hosts file to point to the same gmail host. For example:

machine imap.gmail1.com login [email protected] password soup
machine smtp.gmail1.com login [email protected] 587 password soup

machine imap.gmail2.com login [email protected] password soup2
machine smtp.gmail2.com login [email protected] 587 password soup2

Notice that this also frees you from using foreign servers, since GNUS will consider gmail1.com as one source and gmail2.com as another source.

Here's how your set up can be:

(setq gnus-select-method '(nntp "news.server.some.where"))
(setq gnus-secondary-select-methods 
      '((nnimap "imap.gmail1.com"
                (nnimap-address "imap.gmail1.com")
                (nnimap-server-port 993)
                (nnimap-stream ssl))
        (nnimap "imap.gmail2.com"
                (nnimap-address "imap.gmail2.com")
                (nnimap-server-port 993)
                (nnimap-stream ssl))
        ))
1

i managed to do this by using 2 different .authinfo files like this:

(setq gnus-secondary-select-methods
      '((nnimap "[email protected]"
                (nnimap-address "imap.gmail.com")
                (nnimp-authinfo-file ".authinfo_one")
                (nnimap-server-port 993)
                (nnimap-stream ssl))
        (nnimap "[email protected]"
                (nnimap-address "imap.gmail.com")
                (nnimp-authinfo-file ".authinfo_two")
                (nnimap-server-port 993)
                (nnimap-stream ssl))))

The two .authinfo files then feature the same host, but different username/passwords:

machine imap.gmail.com login user1 password "password1"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .