I think you need to handle post request first.
You have to do this because gutenberg calls the hook twice.
function transition_post_status_handler( $new_status, $old_status, $post ) {
if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) {
send_mail_on_publish( $new_status, $old_status, $post );
set_transient( 'post_status_updater_flag', 'done', 10 );
} else {
if ( false === get_transient( 'post_status_updater_flag' ) )
send_mail_on_publish( $new_status, $old_status, $post );
}
}
add_action( 'transition_post_status', 'transition_post_status_handler', 10, 3 );
Then you can call the function to send the email.
At this point I think you have the data of the meta available.
function send_mail_on_publish( $new_status, $old_status, $post ) {
if ( 'publish' == $new_status && 'immobile' == get_post_type($post) ) {
// Check if not an autosave
if ( wp_is_post_autosave( $post->ID ) )
return;
// Check if not a revision
if ( wp_is_post_revision( $post->ID ) )
return;
// Send email
}
}