My Pleasure.
Below is the updated code to send the approved product mail only when the product is approved 1st time.
add_action('transition_post_status', 'send_mail_vendor', 10, 3);
function send_mail_vendor($new_status, $old_status, $post) {
$already_published = get_post_meta($post->ID,'already_published',true);
if($already_published != 'yes') {
if( $old_status != 'publish' && $new_status == 'publish' && !empty($post->ID) && in_array( $post->post_type, array( 'product') ) ) {
$vendor_id = get_post_field( 'post_author', $post->ID );
$vendor_data = get_userdata($vendor_id);
$mailbody = "Hi Vendor, \n\n Your product ".esc_html($post->post_title)." is approved and listed on Eventfully. \n\n";
wp_mail($vendor_data->user_email,'Eventfully - Product Approved', $mailbody);
update_post_meta($post->ID,'already_published','yes');
}
}
}