3

I used to read my email with neomutt and get them from server with fetchmail. For a time, I switched to using mostly my webmail, but now I'd like to combine mail archives managed by mutt and continuing to use webmail.

This could be achieved in several ways I'm sure, what I think more convenient for me is to use imap mailboxes side by side with local ones in mutt.

I find examples of imap-only muttrc files, but I am not sure how to configure mutt to have both local and imap ones. The most confusing is that there seems to be one $folder variable only, and that depending on whether the mailbox is local or imap, this variable should be set do ~/Maildir or to imaps://host.

So, how do I configure mutt to still have ~/Maildir/Inbox as my spoolfile and imaps://host/Inbox as an additional mailbox?

Joce
  • 1,092

2 Answers2

2

You can use two $folder variables in your .muttrc:

set folder = imaps://some@email.com@some.server.com:993  
set spoolfile = "=INBOX"  
mailboxes =INBOX  
set folder = "~/Mail"

The first 'set folder' sets the imap folder and the variable to use with 'set spoolfile' and 'mailboxes'. Afterwards, a second 'set folder' changes the variable to your local mail folders. In mutt, changing folder to local ~/Mail is by 'c?' or 'ytab'. In neomutt, sometimes you have to use 'c?tab=' or 'ytab='. You can change back to your imap inbox with 'y'.

I copied this from someone's muttrc posted online a long time ago. This works for me and allows my webmail inbox or gmail to work together with my local mail folders.

Hope this helps, ErwinKKK

1

For this the configuration command mailboxes needs to be used.

In the following example I combine it with the configuration variable folder, such that the IMAP folder is opened as the default (i.e., when neomutt starts). This also allows me to define record, postponed, and trash on the IMAP server. The local inbox in this simple example is ~/Mail/INBOX/.

set folder = 'imaps://.../'
set imap_user = "username"
set imap_pass = "password"
set spool_file = +"INBOX"
set record = +"Sent"
set postponed = +"Drafts"
set trash = +"Trash"

local folder (for backing up mail)

mailboxes = -label IMAP imaps://.../
-label LOCAL ~/Mail/INBOX/

When you want to change configuration variables on a per-folder basis (e.g. different real_name or from, or other variables), then have a look at the powerfull folder-hook command.

Now you can press c followed by ? and switch between the mailboxes.

(Note: It is a security risk to store the imap_pass in clear text, so I recommend using one of the methods mentioned in the arch-wiki)