Make WordPress Core

Ticket #37736: 37736.diff

File 37736.diff, 1.4 KB (added by DrewAPicture, 8 years ago)
  • src/wp-includes/pluggable.php

     
    349349         */
    350350        $from_name = apply_filters( 'wp_mail_from_name', $from_name );
    351351
    352         $phpmailer->setFrom( $from_email, $from_name );
     352        $phpmailer->setFrom( $from_email, $from_name, false );
    353353
    354354        // Set destination addresses
    355355        if ( !is_array( $to ) )
  • tests/phpunit/tests/mail.php

     
    342342                        $this->assertEquals( $expected[ $header ], array_pop( $target_headers ) );
    343343                }
    344344        }
     345
     346        /**
     347         * Test that the Sender field in the SMTP envelope is not set by Core
     348         *
     349         * Correctly setting the Sender requires knowledge that is not available to Core. An incorrect value will
     350         * often lead to messages being rejected by the receiving MTA, so it's the admin's responsibility to
     351         * set it correctly.
     352         *
     353         * @ticket 37736
     354         */
     355        public function test_wp_mail_sender_not_set() {
     356                wp_mail( 'user@example.org', 'Testing the Sender field', 'The Sender field should not have been set.' );
     357
     358                $mailer = tests_retrieve_phpmailer_instance();
     359
     360                $this->assertEquals( '', $mailer->Sender );
     361        }
    345362}