Just like WordPress sends out email notifications to the administrator when new comments are posted, sending out emails when visitors post new book reviews allows website managers to review new content as it comes in and decide if they approve it to be published online.
This recipe shows how to prepare email data and send it using the wp_mail
function.
You should be running the final version of the Book Reviews plugin created in Chapter 4, The Power of Custom Post Types, and should have already followed the Saving user-submitted data in custom post types recipe (including changing the post status to draft as indicated in the There's more... section). Alternatively, you can get the resulting files from the code bundle (Chapter 4/ch4-book-reviews/ch4-book-reviews-v11.php
and Chapter 6/ch6-book-review-user-submission/ch6-book-review-user-submission-v2.php
) and rename ch6-book-review-user-submission-v2.php
to ch6-book-review-user-submission...