The wp_mail function can be used by any plugin to send out email messages. It takes five arguments to define all the elements of the outgoing message:
wp_mail( $destination, $subject, $message, [$headers],
[$attachments] );
The first three arguments are required and respectively define the email address of the intended recipient, the title of the message, and its content. As we have seen in this recipe, the content is mainly specified using standard HTML syntax, while the target email address is retrieved from the options table using the get_option function. As for the title, it is built from a number of textual elements, such as the blog title and book review title, to create the final result.
The next parameter is optional and provides header information for the email, with the most important piece of information in that section being the character set. The last parameter can optionally be used to specify the path of one or more files to be sent as email attachments.
To make it easier for website administrators to manage new entries, part of the message body contains a link to the custom post management page of the WordPress website administration area to quickly display all the unapproved entries (set as draft items).