Linux – Configure mutt with multiple mailboxes

emaillinuxmutt

can someone help me with mutt (im new with this)
ive got something like this :

/home/mainuser/Mail
--user1 (softlink to /home/user1/Maildir)
----new
----cur
----tmp
--user2 (softlink to /home/user2/somedir1/somedir2/Maildir)
----new
----cur
----tmp

….
and so on (about 10 users)
all users are local/system/virtual

and now i dont know how to configurate muttrc for this.
there is commands like spoolfile / mailbox but im doing somtheing wrong with em.

Best Answer

You are very likley to run into a file permission mess the way you are trying to do this.

The proper way to configure this would be to tell mutt about accessing the mailboxes through some sort of protocol that allows user authentication so that the mailboxes get touched as the correct user. You can do this by adding macros to your ~/.muttrc file like this:

# Utility macro to change sent, drafts and other folders after changing mailboxes
macro index,pager Mx "set folder=!<enter>:set record=!/.Sent<enter>:set postponed=!/.Drafts<enter>"
# Macro to change to using the users Mail directory
macro index,pager Mu ":set spoolfile=~/Mail<enter>Mx<change-folder>!<enter>" "Mailbox: userdir"
# Macro to switch to an imap mailbox
macro index,pager Mi ":set imap_user=username<enter>:set spoolfile=imap://server/INBOX<enter>Mx<change-folder>!<enter>" "Mailbox: imapuser"

Those macros would allow you to fire off a macro Mu to use the mailbox in your user directory or Mi to switch to an imap mailbox of another user. You can keep adding such macros for more mailboxes that you access.

If all those mailboxes are owned by the same user, setting the symlinks like you reference and then setting spooolfile=~/Mail should do the trick

Related Topic