.muttrc
The Mutt configuration file is ~/.muttrc, i.e. the file called .muttrc in your home directory. It's up to you to create it and configure it. Mutt won't create it for you. With no configuration file, you just get the mail on your local machine (if you have local mail set up, which is not the case on Ubuntu by default).
Most email providers support IMAPS to read your mailbox and manage your emails, and SMTPS to send emails. Thus the bare minimum you need to use a remote account is to set smtp_url to the correct smtps:// URL and to navigate to a folder that is an imaps:// URL. You will probably want a few additional settings, including:
Gmail
Note that for Gmail you'll need to either set up a per-application password (preferred) or enable plain IMAP access. What Gmail calls “less secure” is applications that use your “main” Gmail password to authenticate, as opposed to either the main password plus a second authentication factor or a per-application, non-memorable password.
Looking around I find a surprising number of incomplete tutorials. There's a lot of information in the Arch wiki, as usual, but it's a bit hard to digest. I'll try to be complete here but I don't actually use Mutt for Gmail so this is untested, comments welcome. Assuming that your Gmail address is [email protected] and your application password is qwertyuiop, your .muttrc should contain something like this.
set my_address = [email protected]
set smtp_pass = qwertyuiop
set imap_user = $my_address
set imap_pass = $smtp_pass
set smtp_url = smtps://[email protected]:465/
set folder = imaps://imap.gmail.com:993
set postpones = Drafts
unset record # Gmail does this automatically
set spoolfile = +INBOX
mailboxes +INBOX
set from = $my_address
alternates $my_address
set message_cachedir = ~/.cache/mutt
set header_cache = $message_cachedir
If you don't want to keep your password in your configuration file, see Mutt: how to safely store password?
Accessing multiple accounts
Mutt is a bit awkward when it comes to having multiple accounts. The way it works is, you put all the commands to configure each account in hooks. When you switch from one account to another, Mutt runs the hook commands. The SMTP and IMAP configuration commands go in the account-hook while the rest (record, from, …) go into folder-hook. The alternates and mailboxes settings are a list that should contain one entry per account.
Alternatively, use a separate configuration file for each account. It's less convenient but simpler.
Alternatively, use OfflineIMAP to retrieve email from all your accounts, and use Mutt purely locally (except for sending).