March 24, 2024

Add a second email account to your Mutt, msmtp, mbsync configuration

To add a second email address, I updated my Mutt, msmtp and mbsync configurations with the following:

In .muttrc

I read https://marlam.de/msmtp/msmtp.html#Using-msmtp-with-Mutt and updated my config with:

set sendmail ="/usr/bin/msmtp"  # path/to/msmtp
set realname = 'Firstname Surname' 
set use_from = yes
set envelope_from = yes  
set from = email1@email.com 
# I got the following macro from elsewhere; the suggested macro in msmtp doc did not function as expected 
macro compose <esc>1 '<esc>f^UFirstname Surname <email1@email.com><enter>'
macro compose <esc>2 '<esc>f^UFirstname Surname <email2@email.com><enter>'

In .msmtprc

I added:

account email2
host mail.xxxx.com
port 587
from email2@email.com
user email2@email.com
passwordeval "gpg --quiet --for-your-eyes-only --no-tty --decrypt ~/.config/mutt/password_email2.gpg"

To learn how to store your password encrypted, read the section Store your password in an encrypted file’ of this wiki: https://yctct.com/mutt-gpg-mbsync-msmtp-notmuch#store-pass

In .mbsyncrc

I added:

IMAPAccount email2
Host mail.xxx.com
Port 993
User email2@email.com
PassCmd "gpg -dq $HOME/.config/mutt/password_email2.gpg"
SSLType  IMAPS 
AuthMechs PLAIN 

IMAPStore email2-remote
Account email2
    
MaildirStore email2-local
SubFolders Verbatim
Path ~/Mail/email2/ # the trailing "/" matters
Inbox ~/Mail/email2/INBOX
Flatten . # useful with Mutt according to mbsync manpage
   
Channel email2
Far :email2-remote:
Near :email2-local:
SyncState *
Sync All 
Patterns * INBOX
Create Both
Expunge Both

I had to create /Mail/email2:

$ mkdir /Mail/email2

Check

In the email header of the recipient email address, check that the host is the one you expect to be assciated with the host of the From: email address.

Issues I have

macro compose <esc>2 '<esc>f^UFirstname Surname <email2@email.com><enter>'

Firstname Surname does not show up in the name field of the mailbox of the recipient. Instead the recipient sees . I don’t know if I am doing something wrong. I want to try fiddling with the set_from_header on in my .msmtprc.

See also the wiki:

✍✍✍✍✍✍✍✍✍✍✍✍✍✍

I do self-funded research and I'm writing a book.

> What's the book about?

About technologies and agency.

Meaning, technologies can foster agency. No doubt. But I am also asking:

Can usage of technologies give us a sense of empowerment while in fact undermining our abilities?

I posted a summary of the prologue on the homepage: https://yctct.com/

✍✍✍✍✍✍✍✍✍✍✍✍✍✍


personal computing command-line interface (cli) gnu linux trisquel shell literacy office applications wiki mutt msmtp mbsync

No affiliate links, no analytics, no tracking, no cookies. This work © 2016-2024 by yctct.com is licensed under CC BY-ND 4.0 .   about me   contact me   all entries & tags   FAQ   GPG public key

GPG fingerprint: 2E0F FB60 7FEF 11D0 FB45 4DDC E979 E52A 7036 7A88