(Note that port 465 might be the usual, but fastmail uses 565 to allow stripping the ip.)

# ~/.msmtprc
defaults
tls on
tls_trust_file /usr/local/etc/openssl/cert.pem
auth on

account fastmail
port 565
host smtp.fastmail.com
from <custom_email_address>
user <account_email_address>
tls_starttls off
passwordeval try_random_strings

account uw
port 587
host smtp.gmail.com
from <email_address>
user <email_address>

account default : fastmail
# ~/.mbsyncrc
Create Both
Remove Slave
Expunge Both
CopyArrivalDate yes
SyncState *

IMAPStore fastmail
Host imap.fastmail.com
User <account_email_address>
PassCmd try_random_strings
SSLType IMAPS

MaildirStore local-fastmail
Path ~/mbsync/fastmail/
Inbox ~/mbsync/fastmail/INBOX
Flatten ..

Channel inbox
Master :fastmail:
Slave :local-fastmail:

Channel sent
Master :fastmail:Sent
Slave :local-fastmail:Sent

Channel rest
Master :fastmail:
Slave :local-fastmail:
Patterns "*" "!INBOX" "!Sent"
# ~/.mailcap
application/pdf; open -W -a Skim.app %s
text/html; open -W -a 'Google Chrome.app' %s
text/html; w3m -I %{charset} -T text/html; copiousoutput;

You’ll want to set spoolfile, record, and postponed, which are like INBOX, Sent and Drafts. You can use folder variable to shorten repetitive paths, then = or + will expand to folder, for example,

set folder    = "~/Maildir/"
set spoolfile = "+INBOX"
set record    = "+Sent"
set postponed = "+Drafts"

Some config I had I think prefers plain text or something.

# -*- conf -*-
text/html; w3m -I %{charset} -T text/html; copiousoutput;

## move to Trash ## mark as deleted ## expunge