I really should give imapfilter, offlineimap, msmtp, and neomutt a try. Claws Mail is OK, but still graphical and its configuration probably isn't easily version-controlled.
https://jason.the-graham.com/2011/01/10/email_with_mutt_offlineimap_imapfilter_msmtp_archivemail/