I'm using msmtp and I use app passwords for 2FA.
pacman -S msmtp
I have the message-send-mail-function in Emacs set to message-send-mail-with-sendmail.
/home/christopher/.config/msmtp/config has:
Notice that there is nothing about authorization. Msmtp knows how to look in the Gnome keyring. I have a keyring named login, and the password to it is the same as my login password; doing this causes the keyring to be unlocked when I login to my session. I store my email passwords in this same keyring, which stays unlocked for the duration of my session, so I am never asked for a password to send or receive email.
Gnome-keyring has few dependencies. I use it even though I use Xfce and I don't have Gnome installed.
pacman -S gnome-keyring
pacman -S libsecret
The app passwords were put into the Gnome keyring like so:
secret-tool store --label=msmtp host
smtp.gmail.com service smtp user christophergray168
At the "Password:" prompts, input the appropriate app password for each account.
I use mbsync to sync the imap accounts:
pacman -S isync
I don't give the whole configuration here, since you were asking about smtp. And whatever sync tool you are using probably has something equivalent to mbsync's PassCmd.
Fastmail, and also Gmail use the same app password for imap as smtp so my .mbsyncrc has:
PassCmd "secret-tool lookup user christophergray168"
which looks up, for mbsync, the passwords that were stored the way msmtp likes them, i.e, you don't need to store them twice.