Add a new email account to Mutt’s configuration files
This is a follow up from: https://yctct.com/mutt-gpg-mbsync-msmtp-notmuch
TL;DR:
- update
.muttrc - create an encrypted file with the password
- create a directory for the new mailbox
- update
.mbsyncrc - update
.msmtprc - update
.config/mutt/mailboxes
In .muttrc, add:
macro compose <esc>3 '<esc>f^UFirstName LastName <user@example.com><enter>'
to update the field From by pressing 3 when sending an email.
Create an encrypted file to store the password of the email account, see https://yctct.com/mutt-gpg-mbsync-msmtp-notmuch
Create a directory for the new mailbox locally:
$ mkdir Mail/user@example.com
In .mbsyncrc, add:
########################################
# Start of config for user@example.com #
########################################
IMAPAccount account_name
Host imap.example.org
Port 993
User user@example.com
PassCmd "gpg -dq $HOME/.config/mutt/password.gpg"
SSLType IMAPS
AuthMechs PLAIN
IMAPStore account_name-remote
Account account_name
MaildirStore account_name-local
SubFolders Verbatim
Path ~/Mail/user@example.com/ # the trailing "/" matters
Inbox ~/Mail/user@example.com/INBOX
Flatten . # useful with Mutt according to mbsync manpage
Channel account_name
Far :account_name-remote:
Near :account_name-local:
SyncState *
Sync All
Patterns * INBOX
Create Both
Expunge Both
######################################
# End of config for user@example.com #
######################################
In .msmtprc, add:
account account_name
host smtp.example.com
port 587
from user@example.com
user user@example.com
passwordeval "gpg --quiet --for-your-eyes-only --no-tty --decrypt ~/.config/mutt/password.gpg"
In .config/mutt/mailboxes, add:
# mailboxes for new email address
mailboxes -label "user@example.com/INBOX" "+user@example.com/INBOX"
mailboxes -label "user@example.com/Sent" "+user@example.com/Sent"
mailboxes -label "user@example.com/Archive" "+user@example.com/Archive"
mailboxes -label "user@example.com/Junk" "+user@example.com/Junk"
mailboxes -label "user@example.com/Trash" "+user@example.com/Trash"
notmuch will archive emails.
personal computing command-line interface (cli) gnu linux trisquel shell literacy wiki mutt mbsync msmtp