<?php

function drk_send_application_form(WP_REST_Request $request)
{
    $message = $request->get_param('form_message');
    $args = array(
        'role'    => 'administrator',
        'orderby' => 'user_nicename',
        'order'   => 'ASC'
    );
    $users = get_users( $args );
    foreach ($users as $user){
        $admins_email[] = $user->user_email;
    }
    $admin_email = implode(',', $admins_email);
    return wp_mail($admin_email,"New application message",$message);
}