Index: src/wp-includes/class-wp-recovery-mode-email-service.php
===================================================================
--- src/wp-includes/class-wp-recovery-mode-email-service.php	(revision 1199a99f73f73bbe33f1dc5d944d2a6200ebcf90)
+++ src/wp-includes/class-wp-recovery-mode-email-service.php	(date 1569063736611)
@@ -138,7 +138,16 @@
 		 */
 		$support = apply_filters( 'recovery_email_support_info', __( 'Please contact your host for assistance with investigating this issue further.' ) );
 
-		/* translators: Do not translate LINK, EXPIRES, CAUSE, DETAILS, SITEURL, PAGEURL, SUPPORT: those are placeholders. */
+		/**
+		 * Filters the debug information included in the fatal error protection email.
+		 *
+		 * @since 5.3.0
+		 *
+		 * @param $message array An associated array of debug information.
+		 */
+		$debug = apply_filters( 'recovery_email_debug_info', $this->get_debug( $extension ) );
+
+		/* translators: Do not translate LINK, EXPIRES, CAUSE, DETAILS, SITEURL, PAGEURL, SUPPORT. DEBUG: those are placeholders. */
 		$message = __(
 			'Howdy!
 
@@ -154,6 +163,9 @@
 
 To keep your site safe, this link will expire in ###EXPIRES###. Don\'t worry about that, though: a new link will be emailed to you if the error occurs again after it expires.
 
+When seeking help with this issue, you may be asked for some of the following information:
+###DEBUG###
+
 ###DETAILS###'
 		);
 		$message = str_replace(
@@ -165,6 +177,7 @@
 				'###SITEURL###',
 				'###PAGEURL###',
 				'###SUPPORT###',
+				'###DEBUG###',
 			),
 			array(
 				$url,
@@ -174,6 +187,7 @@
 				home_url( '/' ),
 				home_url( $_SERVER['REQUEST_URI'] ),
 				$support,
+				implode( "\r\n", $debug ),
 			),
 			$message
 		);
@@ -207,6 +221,10 @@
 			restore_previous_locale();
 		}
 
+		echo '<pre>';
+		print_r( $message );
+		echo '</pre>';
+
 		return $sent;
 	}
 
@@ -236,28 +254,12 @@
 	private function get_cause( $extension ) {
 
 		if ( 'plugin' === $extension['type'] ) {
-			if ( ! function_exists( 'get_plugins' ) ) {
-				require_once ABSPATH . 'wp-admin/includes/plugin.php';
-			}
-
-			$plugins = get_plugins();
+			$plugin = $this->get_plugin( $extension );
 
-			$name = '';
-
-			// Assume plugin main file name first since it is a common convention.
-			if ( isset( $plugins[ "{$extension['slug']}/{$extension['slug']}.php" ] ) ) {
-				$name = $plugins[ "{$extension['slug']}/{$extension['slug']}.php" ]['Name'];
+			if ( false === $plugin ) {
+				$name = $extension['slug'];
 			} else {
-				foreach ( $plugins as $file => $plugin_data ) {
-					if ( 0 === strpos( $file, "{$extension['slug']}/" ) || $file === $extension['slug'] ) {
-						$name = $plugin_data['Name'];
-						break;
-					}
-				}
-			}
-
-			if ( empty( $name ) ) {
-				$name = $extension['slug'];
+				$name = $plugin['Name'];
 			}
 
 			/* translators: %s: Plugin name. */
@@ -272,4 +274,75 @@
 
 		return $cause;
 	}
+
+	/**
+	 * Return the details for a single plugin based on the extension data from an error.
+	 *
+	 * @param array $extension The extension that caused the error.
+	 *
+	 * @return bool|array A plugin array {@see get_plugins()} or `false` if no plugin was found.
+	 */
+	private function get_plugin( $extension ) {
+		if ( ! function_exists( 'get_plugins' ) ) {
+			require_once ABSPATH . 'wp-admin/includes/plugin.php';
+		}
+
+		$plugins = get_plugins();
+
+		// Assume plugin main file name first since it is a common convention.
+		if ( isset( $plugins[ "{$extension['slug']}/{$extension['slug']}.php" ] ) ) {
+			return $plugins[ "{$extension['slug']}/{$extension['slug']}.php" ];
+		} else {
+			foreach ( $plugins as $file => $plugin_data ) {
+				if ( 0 === strpos( $file, "{$extension['slug']}/" ) || $file === $extension['slug'] ) {
+					return $plugin_data;
+				}
+			}
+		}
+
+		return false;
+	}
+
+	/**
+	 * Return debug information in an easy to manipulate format.
+	 *
+	 * @param array $extension The extension that caused the error.
+	 *
+	 * @return array An associated array of debug information.
+	 */
+	private function get_debug( $extension ) {
+		$theme = wp_get_theme();
+		$wp_version = get_bloginfo( 'version' );
+
+		if ( $extension ) {
+			$plugin = $this->get_plugin( $extension );
+		} else {
+			$plugin = null;
+		}
+
+		$debug = array(
+			// translators: %s: Current WordPress version number.
+			'wp'    => sprintf(
+				__( 'WordPress version %s' ),
+				$wp_version
+			),
+			'theme' => sprintf(
+				// translators: 1: Current active theme name. 2: Current active theme version.
+				__( 'Current theme: %1$s (version %2$s)' ),
+				$theme->get( 'Name' ),
+				$theme->get( 'Version' )
+			),
+		);
+
+		if ( null !== $plugin ) {
+			$debug['plugin'] = sprintf(
+				// translators: 1: The failing plugins name. 2: The failing plugins version.
+				__( 'Current plugin: %1$s (version %2$s)' ),
+				$plugin['Name'],
+				$plugin['Version']
+			);
+		}
+
+		return $debug;
+	}
 }
