Index: tests/phpunit/tests/mail.php
===================================================================
--- tests/phpunit/tests/mail.php	(revision 41183)
+++ tests/phpunit/tests/mail.php	(working copy)
@@ -362,6 +362,21 @@
 	}
 
 	/**
+	 * Test that the From parameter has been set in phpmailer instance and not kept default.
+	 * Even in the case when SERVER_NAME is not available.
+	 *
+	 * @ticket 40810
+	 */
+	public function test_wp_mail_from_not_default() {
+		$_SERVER['SERVER_NAME'] = '';
+		wp_mail( 'user@example.org', 'Testing the From field', 'The From field should not be default.' );
+
+		$mailer = tests_retrieve_phpmailer_instance();
+
+		$this->assertNotEquals( 'root@localhost', $mailer->From );
+	}
+
+	/**
 	 * @ticket 35598
 	 */
 	public function test_phpmailer_exception_thrown() {
