I have a gmail account, and have set up gnus to read my email over IMAP. I'm also subscribed to a few mailing lists, and want them to be placed in individual directories, e.g. ml-openstack, ml-dpdk etc. so that when I open gnus, I have them not in INBOX, but in ml-openstack, ml-dpdk and so forth.

What should I tweak in emacs/gnus configuration to achieve this? Thanks.

1 Answer 1


In Gnus it's called "splitting" the mail. It's covered in section 6.4.3 of the Gnus manual. (run M-: (info "(gnus)Splitting Mail") to jump right to it. Here's an example from the manual:

(setq nnmail-split-methods
  '(("mail.junk" "^From:.*Lars Ingebrigtsen")
    ("mail.crazy" "^Subject:.*die\\|^Organization:.*flabby")
    ("mail.other" "")))

You can see that it takes a list of folders to split into, and regexes to match against.

Since you're using IMAP, however, you want to set the variable nnimap-split-methods instead. It works the same way, but only applies to IMAP. See section 6.3.3 of the manual for more details.

Also, you might consider setting up filters in the Gmail UI instead, so that email is always sorted correctly even when you're not running Gnus.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.