Wp cron event is set but the function isn't getting fired

I’m a WP cron beginner trying to make some test function.

So i have a test page with this code:

if ( ! wp_next_scheduled( 'do_this_in_an_hour' ) ) {
wp_schedule_single_event( time() + 40, 'do_this_in_an_hour' );
}

And for the testing:

echo wp_next_scheduled( 'do_this_in_an_hour' );

echo '<pre>';
$cron_jobs = get_option( 'cron' );
var_dump($cron_jobs);
echo '</pre>';

And in my functions.php (not sure i have to put that there):

function do_this_in_an_hour() {
    wp_mail('mymail@gmail.com','this is a cron test!','great here is the massage!');
}
add_action( 'my_new_event', 'do_this_in_an_hour', 10, 3 );

Now i see that the cron job is added to the cron job array and i do get a timestemp for next_scheduled function and it is removed from the cron jobs array after i refresh when the time is passed (40 seconds), but the mail isn’t sending (of course in the real code i have my real mail address and i did test the mail function alone and it’s working).

Any idea what i’m doing wrong?

Solutions Collecting From Web of "Wp cron event is set but the function isn't getting fired"

I needed the hook name and not the function name so instead of this:

if ( ! wp_next_scheduled( 'do_this_in_an_hour' ) ) {
wp_schedule_single_event( time() + 40, 'do_this_in_an_hour' );
}

That:

if ( ! wp_next_scheduled( 'my_new_event' ) ) {
wp_schedule_single_event( time() + 40, 'my_new_event' );
}