Identifying multiple imap accounts with new mail in sidebar

meine trialero at gmx.com
Sun Feb 26 11:19:06 UTC 2023


On Fri, Feb 24, 2023 at 12:59:13PM +0000, Neubienaut wrote:
> [...]
> I would like to view my various imap accounts in the sidebar with count 
> of new messages so I don't have to reopen each account in mutt (with
> mutt -f 'imap config file') to check for new mail.

I don't have any experience with a sidebar in mutt, but do have a setup
with two accounts (one POP, one IMAP).

I just have to start mutt and can switch between the accounts by
pressing `F2` or `F3` for each of the accounts. The IMAP account updates
automatically when opened, the POP account needs a Shift+G to check for
new mails -- a choice I made to either download new mail and delete them
on the server, or to preserve a copy on the server.

The setting works with folder-hooks in my muttrc that point to files
with settings for both accounts. The `source` in the lines below point
to that file.

Since the IMAP mails are kept on the external server, there is no
directory structure on my box to keep the mails. For the POP account the
default mutt directory structure is used.

The Arch Linux site has very good instructions to make your mutt setup
work! See wiki.archlinux.org/index.php/Mutt

Hope this helps you in making a comfortable setup!

KR,

//meine

* In your muttrc:

    ## ACCOUNT IMAP [F2]
    source "~/.mutt/imap"
    folder-hook <imap-account> 'source ~/.mutt/imap'

    ## ACCOUNT POP [F3]
    source "~/.mutt/pop"
    folder-hook $folder 'source ~/.mutt/pop'

    ## Shortcuts
    macro index,pager <f2> '<sync-mailbox><enter-command>source
    ~/.mutt/imap<enter><change-folder>!<enter>'
    macro index,pager <f3> '<sync-mailbox><enter-command>source
    ~/.mutt/pop<enter><change-folder>!<enter>'

* File for each account:

    ## ACCOUNT POP

    ##Receive options
    set mbox_type = Maildir
    set folder = $HOME/mail
    set spoolfile = $HOME/mail/inbox
    set record = $HOME/mail/sent
    set postponed = $HOME/mail/draft
    set pop_host = "<mail-address>:<password>@<pop-server-address>"

    ##Send options 
    set smtp_url = "smtp://<mail-address>@<smtp-server-address>:<port>/"
    set smtp_pass = "<password>"
    set pop_user = "<mail-address>
    set realname = "<common-name>"
    set from = "<mail-address>"
    set signature = "~/.signature"

    ##Connection options
    set ssl_force_tls = yes
    set ssl_starttls = yes

    ## Hook -- IMPORTANT!
    account-hook $folder "set pop_user=<mail-address>
    pop_pass=<password>"

/EOF


More information about the Mutt-users mailing list