htmlBody !== '' ) { $headers[] = 'Content-Type: text/html; charset=UTF-8'; $body = $message->htmlBody; } else { $body = $message->textBody; } if ( $message->replyTo !== null ) { $headers[] = 'Reply-To: ' . $message->replyTo; } foreach ( $message->cc as $cc ) { $headers[] = 'Cc: ' . $cc; } foreach ( $message->bcc as $bcc ) { $headers[] = 'Bcc: ' . $bcc; } $attachments = array_map( fn( array $a ) => $a['path'], $message->attachments ); wp_mail( $message->to, $message->subject, $body, $headers, $attachments ); } /** * Sends a simple text email using wp_mail(). */ public function sendSimple( string $to, string $subject, string $body ): void { $this->send( EmailMessage::text( $to, $subject, $body ) ); } }