For tests: from now on in this run, mail is kept instead of sent, queued or not. $mail->has_sent('joan@example.com') checks it and $mail->sent() lists it.
Sends an email and returns it as a map. to (and cc and bcc) take an address, a user with an email, or a list of them. The body is html, text, or a view from the views folder (mail/welcome is views/mail/welcome.html or .md) given data as its variables; HTML mail gets a plain-text copy too. from defaults to config.mail.from. attachments are file paths. queue sends it from kscript worker instead of now, on config.mail.queue. config.mail.driver picks how it is sent: smtp, log (the default) or fake.