On Sun, Jan 15, 2023 at 08:58:19PM +0100, Matěj Cepl <mc...@cepl.eu> wrote:
> Hi, > > I am looking for the terminal-based MUA which would be able to > work with my email needs. However, for various reasons I really > need all my emails stay on multiple IMAP accounts (no local > emails if possible). I have started with mutt as it is the > client I know best, but I am not married to it, if you know > about anything better (Alpine?, notmuch?, anything else) which > could help me, then I am all ears. Have a look at neomutt. It's based on mutt, and might or might not be different in relation to account hooks. > account-hook .*localhost 'set imap_user=matej imap_pass=secret1 \ > from="Matěj Cepl <ma...@ceplovi.cz>" > folder=imap://localhost.localdomain \ > trash=+Trash postponed=+Drafts' > # account-hook mcepl 'set imap_user=mc...@cepl.eu imap_pass="secret2" \ > # from="Matěj Cepl <mc...@cepl.eu>" \ > # folder=imaps://redcrew.org trash=+Trash postponed=+Drafts' > account-hook .*redcrew.org 'set imap_user="ma...@ceplovi.cz" \ > imap_pass= "secret3" \ > from="Matěj Cepl <ma...@ceplovi.cz>" \ > folder=imaps://redcrew.org trash=+Trash postponed=+Drafts' > account-hook .*suse.de 'set imap_user=mcepl@Thunderbird \ > imap_pass= "secret4" \ > postponed=+INBOX/Drafts from="Matěj Cepl <mc...@suse.cz>" \ > trash=+INBOX/Trash' > > The problem is obviously mc...@cepl.eu account. > > * Is it possible to have two account hooks directed against one > IMAP server? Kind of. I found this: [mutt] Multiple email accounts using hooks https://nixtricks.wordpress.com/2010/05/20/mutt-multiple-email-accounts-using-hooks/ It has an initial account-hook matching . that unsets things, followed by other account-hooks that sets them depending on the account. So, multiple account-hook directives can match the same account. It just depends on the regular expressions used. But that might not be useful to you. I'm not sure why you want different account-hooks for the same account. If you want two different sets of parameters for the same account (does that even make sense?), then you might need to put them in different rc files, and perhaps create key bindings to load the one you want when you want to change. > * What EXACTLY are possible values of the first parameter of > account-hook. Does it have to be domain name of the server, or > could it be some random string (as shown here in the commented > out account-hook)? Good question. It's not clear from just the account-hook entry in muttrc(5). From the webpage mentioned above, it looks like the regexp needs to match the imap URI (e.g., 'imaps://us...@imap.gmail.com/'). > * Is there some patch somewhere, which would support some more > grown-up version of the accounts settings? I would like to have > something like > > account work { \ > imap_server = imap.suse.de \ > imap_user = mcepl@Thunderbird \ > imap_pass = secret4 \ > ... { any other mutt settings } > } > > account floss { \ > imap_server = redcrew.org \ > imap_user = mc...@cepl.eu \ > imap_pass = secret2 \ > ... { any other mutt settings } > } > > and then I would run > > $ mutt -C work > > (C as aCcount) > > and when inside of mutt I could refer to the other account with > something like > > <save-message>#floss/INBOX/somewhere > > Anybody heard about something like this? No, but the same thing can be achieved with alternate muttrc files and the -F option. When you run "mutt -F work" or "mutt -F floss", the work and floss rc files can contain their specific imap settings, and then source a common rc file with everything else. For saving to the other account, macros would help. If you really like your config syntax above, you could probably write a little tool that "compiled" it into muttrc syntax. > Best, > Matěj cheers, raf