function set_mail_html_content_type() {
return ‘text/html’;
}
add_action( ‘publish_post’, ‘author_publish_notice’, 10 ,2 );
function author_publish_notice( $ID, $post ) {
if( ‘post’ == $post->post_type ) {
return;
}
$to = ‘author@email.com’;
$subject = ‘Your Article Is Online’;
$message = ‘
Congratulations!
Your article is now online and
is sure to receives trillions of comments. Please do hang around and answer any questions
viewers may have!
‘;
add_filter( ‘wp_mail_content_type’, ‘set_mail_html_content_type’ );
wp_mail( $to, $subject, $message );
remove_filter( ‘wp_mail_content_type’, ‘set_mail_html_content_type’ );
}