i've add this function for randomize service provider. It

Hello,
i've add this function for randomize service provider. It works correctly but not with mail notification.

function assign_random_provider( $app_id ) {
global $wpdb, $appointments;
$a = $appointments;
if ( !is_object($a) )
return;
// Get appointment
$app = $wpdb->get_row( 'SELECT * FROM ' . $a->app_table. ' WHERE ID='.$app_id. ' ' );
// Check if a provider is already assigned
if ( !$app || 0 != $app->worker )
return;
// Find providers who can give this service
$workers=$a->get_workers_by_service( $app->service );
if ( !$workers || empty($workers) )
return;
// Randomize
shuffle($workers);
// Find timestamp
$start = strtotime( $app->start );
$end = strtotime( $app->end );
// Check each worker for being busy or not working
foreach ($workers as $worker){
$apps = $a->get_reserve_apps_by_worker( 0, $worker->ID );
$busy = false;
if ( $apps ) {
	foreach ( $apps as $_app ) {
		if ( $start >= strtotime( $_app->start ) && $end <= strtotime( $_app->end ) ) {
			$busy = true;
			break;
		}
	}
}

if ( $busy || !$a->is_working($start,$end,$worker->ID))
continue;
// We found a free provider
$result=$wpdb->update( $a->app_table, array('worker'=>$worker->ID),array('ID'=>$app_id) );
if ( $result )
wp_mail( $a->get_worker_email($worker->ID),'New appointment', 'You have been assigned a new appointment on '. mysql2date($a->datetime_format, $app->start));
}
}
add_action( 'app_new_appointment', 'assign_random_provider' );

Example:
Service A is made by Service Provider A, Service Provider B, Service Provider C

Service Provder B is the random choosen
How can i notify only Service Provider B?
Service Provider A, Service Provider C get however this email
You have been assigned a new appointment on 26 febbraio 2015 15:00

Thank you!