diff --git src/wp-includes/pluggable.php src/wp-includes/pluggable.php
index e5b3e9f8c1..7cf134fb4b 100644
|
|
|
if ( ! function_exists( 'wp_mail' ) ) : |
| 330 | 330 | |
| 331 | 331 | if ( ! isset( $from_email ) ) { |
| 332 | 332 | // Get the site domain and get rid of www. |
| 333 | | $sitename = strtolower( $_SERVER['SERVER_NAME'] ); |
| | 333 | // If SERVER_NAME is not available, hostname will be used. |
| | 334 | if ( ! empty( $_SERVER['SERVER_NAME'] ) ) { |
| | 335 | $sitename = strtolower( $_SERVER['SERVER_NAME'] ); |
| | 336 | } else { |
| | 337 | $sitename = strtolower( php_uname( 'n' ) ); |
| | 338 | } |
| 334 | 339 | if ( substr( $sitename, 0, 4 ) == 'www.' ) { |
| 335 | 340 | $sitename = substr( $sitename, 4 ); |
| 336 | 341 | } |
| … |
… |
if ( ! function_exists( 'is_user_logged_in' ) ) : |
| 984 | 989 | * Determines whether the current visitor is a logged in user. |
| 985 | 990 | * |
| 986 | 991 | * For more information on this and similar theme functions, check out |
| 987 | | * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ |
| | 992 | * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ |
| 988 | 993 | * Conditional Tags} article in the Theme Developer Handbook. |
| 989 | | * |
| | 994 | * |
| 990 | 995 | * @since 2.0.0 |
| 991 | 996 | * |
| 992 | 997 | * @return bool True if user is logged in, false if not logged in. |
diff --git tests/phpunit/tests/mail.php tests/phpunit/tests/mail.php
index 951615136b..bf4c6ef0df 100644
|
|
|
class Tests_Mail extends WP_UnitTestCase { |
| 360 | 360 | $this->assertEquals( '', $mailer->Sender ); |
| 361 | 361 | } |
| 362 | 362 | |
| | 363 | /** |
| | 364 | * Test that the From parameter has been set in phpmailer instance and not kept default. |
| | 365 | * Even in the case when SERVER_NAME is not available. |
| | 366 | * |
| | 367 | * @ticket 40810 |
| | 368 | */ |
| | 369 | public function test_wp_mail_from_not_default() { |
| | 370 | $_SERVER['SERVER_NAME'] = ''; |
| | 371 | wp_mail( 'user@example.org', 'Testing the From field', 'The From field should not be default.' ); |
| | 372 | |
| | 373 | $mailer = tests_retrieve_phpmailer_instance(); |
| | 374 | |
| | 375 | $this->assertNotEquals( 'root@localhost', $mailer->From ); |
| | 376 | } |
| | 377 | |
| 363 | 378 | /** |
| 364 | 379 | * @ticket 35598 |
| 365 | 380 | */ |