wp_mail() is a wrapper for PHPMailer which is a wrapper for PHP’s
bool wp_mail( string $to, string $subject, string $message, [string|array $headers = '' [, string|array $attachments = array() ] ] )
A header must follow the form
Bcc:email@example.com. Multiple headers might be separated by
\n or passed as an array.
An attachment is a path in the local file system. See
PHPMailer::AddAttachment() for details.
In contrast to the raw
mail() function, the WordPress wrapper is a pluggable function: it can be replaced by plugins. This is useful in when the installation needs specific smtp configuration. But this means also
wp_mail() is not available before
plugins_loaded has been called.
PHPMailer is a class delivered by WordPress but developed outside. It handles many edge cases.