Intercepting wp_mail() to view contents

The first link on Google is to https://developer.wordpress.org/reference/functions/wp_mail/ which says that wp_mail is in wp-includes/pluggable.php

It also has the full function source code showing that the first active line of the function is:

$atts = apply_filters( 'wp_mail', compact( 'to', 'subject', 'message', 'headers', 'attachments' ) );

… which suggests that if you hook into the filter you can capture all of those fields.

Additionally as it’s a pluggable function you could also replace it with your own function doing whatever you want with the messages.