Send email to admin user when custom post type is created

If you want to send an email on first publish and on updates, you can avoid many extra checks by using {status}_{post type} action hook. Put the code below into the current theme’s functions.php:

add_action( 'publish_task', 'wpse_admin_email', 10, 2 );
function wpse_admin_email( $post_id, $post ) {
    // prepare and send email code goes here...
}

If you want to send an email on first publish only, use the code below:

add_action( 'transition_post_status', 'wpse_admin_email_once', 10, 3 );
function wpse_admin_email_once( $new, $old, $post ) {
    if ( $post->post_type == 'task' && $new == 'publish' && $old == 'auto-draft' ) {
        // prepare and send email code goes here...
    }
}