Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Mutt + GMail + GMail
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
NotQuiteSane
Guru
Guru


Joined: 30 Jan 2005
Posts: 471
Location: Klamath Falls, Jefferson, USA, North America, Midgarth

PostPosted: Wed Apr 24, 2013 3:57 am    Post subject: Mutt + GMail + GMail Reply with quote

I'm trying to set up mutt to use multiple gmail accounts.

I already use it for my personal account, wanted to add mybusiness account. orginal .muttrc is backed up, and i'm trying to follow this guide. my .muttrc can be seen here. When i run mutt, it scrolls maybe 6 lines of 'unset: unknown variable', asks for my gpg passphrase, then another set of 6 'unset: unknown variable' then opens mutt. Mutt says it has no mailbox, and won't respond to any key, i'm forced to use 'pkill mutt' to close it.

I googled, and found this, but the solution suggested just bypasses the first account and then asks for the password for "user2@gmail.com". do I need to change user{1,2} to the actual account names, and do I need to do anything else to the .muttrc at this time (improvements are planed once I have a working base .muttrc to fall back on)?

NQS
_________________
These opinions are mine, mine I say! Piss off and get your own.

As I see it -- An irregular blog, Improved with new location

To delete French language packs from system use 'sudo rm -fr /'
Back to top
View user's profile Send private message
ppurka
Advocate
Advocate


Joined: 26 Dec 2004
Posts: 3205

PostPosted: Wed Apr 24, 2013 5:11 am    Post subject: Reply with quote

I am contemplating moving from Thunderbird to mutt because of a 100% CPU bug in Thunderbird that has been around for a year. I bookmarked some links to help me in my migration. Maybe it will help you solve your problem too:

  1. http://askubuntu.com/questions/196268/migrate-from-thunderbird-to-mutt (look at the main reply and the links therein)
  2. http://www.burocrata.org/newwiki/MuttRc (setting up multiple accounts)
  3. http://forums.gentoo.org/viewtopic-t-945868.html [KMail to mutt with Maildir and procmail] (not quite what we want, but informative nonetheless)

_________________
emerge --quiet redefined | E17 vids: I, II
Back to top
View user's profile Send private message
khayyam
Advocate
Advocate


Joined: 07 Jun 2012
Posts: 2244

PostPosted: Wed Apr 24, 2013 2:35 pm    Post subject: Reply with quote

NotQuiteSane ...

The 'unknown variable' errors sound to me as though you don't have the requisite useflags set for imap, sasl, and smtp, you probably want the following:

/etc/portage/package.use
Code:
mail-client/mutt crypt imap sasl smime smtp gpg

That said, I have a similar setup but use net-mail/offlineimap rather than mutt for sync'ing mail, and managing various accounts. I also use postfix which does relay dependent on the sender, the reason being that I can sync between various machines, and additionally answer mail when effectively offline (postfix queing the mail and flushing the que when net becomes available).

A brief look over your muttrc suggests that all you need do is add support for imap, sasl and smtp ... but if you want further details on how things are configured here then ask.

best ... khay
Back to top
View user's profile Send private message
ppurka
Advocate
Advocate


Joined: 26 Dec 2004
Posts: 3205

PostPosted: Wed Apr 24, 2013 3:33 pm    Post subject: Reply with quote

khayyam wrote:
That said, I have a similar setup but use net-mail/offlineimap rather than mutt for sync'ing mail, and managing various accounts.
Can you post your offlineimap configuration, after stripping out your private information? I am also interested in using offlineimap to backup my emails locally (multiple gmail accounts <-> local backup).
_________________
emerge --quiet redefined | E17 vids: I, II
Back to top
View user's profile Send private message
khayyam
Advocate
Advocate


Joined: 07 Jun 2012
Posts: 2244

PostPosted: Wed Apr 24, 2013 4:51 pm    Post subject: Reply with quote

ppurka wrote:
Can you post your offlineimap configuration, after stripping out your private information? I am also interested in using offlineimap to backup my emails locally (multiple gmail accounts <-> local backup).

ppurka ... sure, here is an example with two accounts one of which is gmail (all private data removed to protect the innocent ;). Note that with the gmail account some trickery is done to only sync selective directories, and to translate the names, so you may need to edit these to suite your needs. The ~/.offlineimap/pass.* files have nothing but the passphrase (no quotes or fancy business).

If you just want a one off sync, and not have offlineimap in retreaval mode then comment out 'autorefresh' and 'quick' in the 'Account' stanza's. Also, the 'Accounts' could be split into seperate files and so called at different times or what have you.

Ask, you have further question ... though maybe an idea to start a seperate thread so as not to intrude on this one.

HTH & best ... khay
Back to top
View user's profile Send private message
ppurka
Advocate
Advocate


Joined: 26 Dec 2004
Posts: 3205

PostPosted: Wed Apr 24, 2013 5:25 pm    Post subject: Reply with quote

Thanks a lot khayyam! Sorry for intruding in this thread, but I think offlineimap + dovecot + any email client could be a possible configuration.

Currently I have tried out
thunderbird (100% CPU bug, and slow),
claws-mail (ugly and very confusing interface),
evolution (do the evolution devs themselves use that? It crashes left and right),
kmail (gave up on this long ago - tons of bugs; also, I can not trust this one to keep my emails safe),
alpine (very slow over imap; even slower with multiple accounts),
trojita (not featureful enough; very nascent and restricted interface but very fast),
opera mail (not featureful enough; otherwise quite nice).

So, now I am looking at mutt, as well as offlineimap. The configuration of both is daunting, as soon as multiple email accounts need to be handled.
_________________
emerge --quiet redefined | E17 vids: I, II
Back to top
View user's profile Send private message
NotQuiteSane
Guru
Guru


Joined: 30 Jan 2005
Posts: 471
Location: Klamath Falls, Jefferson, USA, North America, Midgarth

PostPosted: Wed Apr 24, 2013 9:12 pm    Post subject: Reply with quote

khayyam wrote:
A brief look over your muttrc suggests that all you need do is add support for imap, sasl and smtp ... but if you want further details on how things are configured here then ask.

best ... khay


I have the following:

Code:
[ebuild   R    ] mail-client/mutt-1.5.21-r12::gentoo [1.5.21-r12::my_local_overlay] USE="berkdb crypt gdbm gpg imap nls sasl smime smtp ssl -debug -doc -gnutls -idn -mbox -nntp -pop -qdbm (-selinux) -sidebar -tokyocabinet" 0 kB


package.use shows:

Code:
mail-client/mutt gpg imap sasl smime smtp


so i guess i can try offlineimap, i did look at it before.

At one time I had 6 addresess all imported into one via POP plus my business account. Had postfix, fetchmail and procmail all set up.

Then I got a gmail account, and an android phone and found I liked IMAP, plus contracting jobs increased over my own domain (go figure). but i'm "old-school", grew up on the command line, and if I can get rid of anything GUI, good.

Still, if I could get these two to work, i'd be happy for now. I can always improve on the setup later, once it is working

NQS
_________________
These opinions are mine, mine I say! Piss off and get your own.

As I see it -- An irregular blog, Improved with new location

To delete French language packs from system use 'sudo rm -fr /'
Back to top
View user's profile Send private message
khayyam
Advocate
Advocate


Joined: 07 Jun 2012
Posts: 2244

PostPosted: Thu Apr 25, 2013 12:01 am    Post subject: Reply with quote

NotQuiteSane wrote:
Code:
[ebuild   R    ] mail-client/mutt-1.5.21-r12::gentoo [1.5.21-r12::my_local_overlay] USE="berkdb crypt gdbm gpg imap nls sasl smime smtp ssl -debug -doc -gnutls -idn -mbox -nntp -pop -qdbm (-selinux) -sidebar -tokyocabinet" 0 kB

NotQuiteSane ... the useflags looks fine.

I think I see the source of the error, you have: account-hook . 'unset imap_user unset imap_pass', try:

Code:
account-hook . 'unset imap_user'
account-hook . 'unset imap_pass'

... also, you 'set folder', 'mailboxes=' for one account and then further down do the exact same for the second account, the second of these will be the one applied as there is no context for the settings ... so some other method is needed. The method I use is the following (but note my offlineimap is configured so that directories that exist for each account have the identical schema).

Code:
send-hook "(~t @)" 'set record="+Sent"'
send-hook "(~f @foo.org)"  'my_hdr From: Foo A. Bar <fooabar@foo.org> ; \
                                my_hdr Reply-To: Foo A. Bar <fooabar@foo.org>'
send-hook "(~f @gmail.com)"  'my_hdr From: Foo A. Bar <fooabar@gmail.com> ; \
                                my_hdr Reply-To: Foo A. Bar <fooabar@gmail.com>'

folder-hook ~/mail/foo-local/INBOX 'set folder="~/mail/foo-local"'
folder-hook ~/mail/gmail-local/INBOX 'set folder="~/mail/gmail-local"'
folder-hook . 'set postponed="+Drafts"'

So, it is by switching between the folders which trigger the '+Sent', '+Drafts', folder, name, and reply_to for the respective accounts.

For mailboxes you don't need to supply +Sent, etc, as this is only for the mailboxes mutt scans for new mail, you can simply have one definition as mutt doesn't need to associate them with an account:

Code:
mailboxes = +foo-local/INBOX +gmail-local/INBOX

With the above folder-hooks mutt needs to be provided with a default account so that at start it knows which mailbox to open, so define the most used account like so:

Code:
set folder="~/mail"
set spoolfile=+foo-local/INBOX
set hostname="foo.org"
alternates "fooabar@(gmail.com|foo.org)|(foo.bar@work.com)"

The above is obviously designed with local mailboxes in mind, but you should be able adapt it for remote imap should you want to go that route (though again, because of the non-standard naming google uses the above hooks will not work ... its a PITA to not have the, mostly, consistant names used in imap).

NotQuiteSane wrote:
so i guess i can try offlineimap, i did look at it before.

The main advantage is being able to sync multiple machines, and or access the mail via some other method and still have them all sync up. Plus, if your using a laptop you can answer your email without needing to be online .... as long as you have some local mailserver (I used postfix) which can defer_transport.

I'm more than happy to post further configs (postfix, mutt, etc) just ask.

best ... khay
Back to top
View user's profile Send private message
NotQuiteSane
Guru
Guru


Joined: 30 Jan 2005
Posts: 471
Location: Klamath Falls, Jefferson, USA, North America, Midgarth

PostPosted: Thu Apr 25, 2013 3:31 am    Post subject: Reply with quote

Well...

I messed up somewhere. I replaces all the user1 and user2 with actual settings, and put in the suggested folder hooks. see http://bpaste.net/show/94008/

But now I put in my pass phrase and get:

Code:
/home/nqs/.mutt/notquitesane/INBOX: No such file or directory (errno = 2)


Also the macros seem unbound.

Also, i'm unsure if this is set for .maildir or .mbox. I want the former.

NQS
_________________
These opinions are mine, mine I say! Piss off and get your own.

As I see it -- An irregular blog, Improved with new location

To delete French language packs from system use 'sudo rm -fr /'
Back to top
View user's profile Send private message
khayyam
Advocate
Advocate


Joined: 07 Jun 2012
Posts: 2244

PostPosted: Thu Apr 25, 2013 1:06 pm    Post subject: Reply with quote

NotQuiteSane wrote:
Code:
/home/nqs/.mutt/notquitesane/INBOX: No such file or directory (errno = 2)

NotQuiteSane ... your setting the folder to ~/.mutt when it should be something like ~/mail, ~/Mail or imap: ... ~/.mutt is where mutt config files, or what-have-you, are stored. The 'folder' is the root of the directory where the mail is delivered to with the 'spoolfile' being relative ("+") to that dir.

NotQuiteSane wrote:
Also the macros seem unbound.

The config file will not work as is ... because 'set foo' sets foo=value ... if its defined again further on then the value is set to something else. Also, as your using imap then the folder and spoolfile need to reflect this fact.

Code:
set hostname="gmail.com"
set imap_user="notquitesane@gmail.com"
set imap_pass=""
set folder="imaps://imap.gmail.com"
set spoolfile=+INBOX
set postponed=+[Gmail]/Drafts
set record=+[Gmail]/'Sent Mail'
set smtp_url="smtp://notquitesane@smtp.gmail.com:587"
set smtp_pass=""
set certificate_file=~/.mutt/certificates
set ssl_force_tls=yes
set ssl_use_sslv3=yes

The spoolfile, record, and postponed are relative ("+") to the folder= ... in the above that would be the remote imap://

NotQuiteSane wrote:
Also, i'm unsure if this is set for .maildir or .mbox. I want the former.

Its neither, its imap ... at least in your case.

best ... khay
Back to top
View user's profile Send private message
NotQuiteSane
Guru
Guru


Joined: 30 Jan 2005
Posts: 471
Location: Klamath Falls, Jefferson, USA, North America, Midgarth

PostPosted: Sun Apr 28, 2013 7:58 pm    Post subject: Reply with quote

khayyam wrote:
NotQuiteSane ... your setting the folder to ~/.mutt when it should be something like ~/mail, ~/Mail or imap: ... ~/.mutt is where mutt config files, or what-have-you, are stored. The 'folder' is the root of the directory where the mail is delivered to with the 'spoolfile' being relative ("+") to that dir.


Ok, i've set it to ~/.mail

khayyam wrote:
NotQuiteSane wrote:
Also the macros seem unbound.

The config file will not work as is ... because 'set foo' sets foo=value ... if its defined again further on then the value is set to something else. Also, as your using imap then the folder and spoolfile need to reflect this fact.


Alright, i'll have to fix those dupes

khayyam wrote:
NotQuiteSane wrote:
Also, i'm unsure if this is set for .maildir or .mbox. I want the former.

Its neither, its imap ... at least in your case.


as long as it's not mbox, i'm happy.

Didn't have time to work on it until today. i'd been using 'mutt -F .muttrc.bak'

Using that and the code you posted last message I created .muttrc. it worked (both files actually have passwords in them, log right in)

I got to thinking about passwords, so i decrypted .passwords.

it looks like
Code:
GMail1     `1234aoeuhtns-
GMail2     \=/l][09;qjk

(not actual passwords)

so I re-created it to show
Code:
GMail1     "`1234aoeuhtns-"
GMail2     "\=/l][09;qjk"


and shifted comments around to get this .muttrc

which fails. it's probably something simple, but i'm going to step back and lookat it again later

NQS
_________________
These opinions are mine, mine I say! Piss off and get your own.

As I see it -- An irregular blog, Improved with new location

To delete French language packs from system use 'sudo rm -fr /'
Back to top
View user's profile Send private message
khayyam
Advocate
Advocate


Joined: 07 Jun 2012
Posts: 2244

PostPosted: Mon Apr 29, 2013 2:58 am    Post subject: Reply with quote

NotQuiteSane wrote:
i've set it to ~/.mail

NotQuiteSane ... if you plan on using the imap method then this needs to be set to the remote mailbox. As I said its the top level of where ever mail is delivered.

NotQuiteSane wrote:
khayyam wrote:
The config file will not work as is ... because 'set foo' sets foo=value ... if its defined again further on then the value is set to something else.[...]

Alright, i'll have to fix those dupes

basically the various settings for seperate mail accounts need to be triggered by some change, ie a 'hook' ... thats what the folder-hooks above do, when switching between folder a and folder b the various set=foo come into effect. You could probably use the same hook but set the folder to the URI of the INBOX ... I imagine you should then be able to add these same URI to 'mailboxes=' and be able to switch with 'c' (change mailbox).

NotQuiteSane wrote:
Using that and the code you posted last message [...] it worked (both files actually have passwords in them, log right in).

OK, good, so all you need do is add some hooks that will change the configuration based on some event.

NotQuiteSane wrote:
I got to thinking about passwords, so i decrypted .passwords. [....] which fails. it's probably something simple, but i'm going to step back and lookat it again later.

Honestly, why not do this:

~/.muttrc
Code:
source ~/.mutt/pass

and ...
Code:
cat ~/.mutt/pass
imap_pass="foo"

You can use some form of encryption, but have it done as part of your login. You still need to provide hooks for doing this but it may be a lot easier to handle.

best ... khay
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum