diff --git a/src/PHPMailer.php b/src/PHPMailer.php index 47dd3022..5444ab39 100644 --- a/src/PHPMailer.php +++ b/src/PHPMailer.php @@ -1122,19 +1122,22 @@ class PHPMailer $params = [$kind, $address, $name]; //Enqueue addresses with IDN until we know the PHPMailer::$CharSet. //Domain is assumed to be whatever is after the last @ symbol in the address - if (static::idnSupported() && $this->has8bitChars(substr($address, ++$pos))) { - if ('Reply-To' !== $kind) { - if (!array_key_exists($address, $this->RecipientsQueue)) { - $this->RecipientsQueue[$address] = $params; + if ($this->has8bitChars(substr($address, ++$pos))) { + if (static::idnSupported()) { + if ('Reply-To' !== $kind) { + if (!array_key_exists($address, $this->RecipientsQueue)) { + $this->RecipientsQueue[$address] = $params; + + return true; + } + } elseif (!array_key_exists($address, $this->ReplyToQueue)) { + $this->ReplyToQueue[$address] = $params; return true; } - } elseif (!array_key_exists($address, $this->ReplyToQueue)) { - $this->ReplyToQueue[$address] = $params; - - return true; } - + //We have an 8-bit domain, but we are missing the necessary extensions to support it + //Or we are already sending to this address return false; } diff --git a/test/PHPMailer/DKIMTest.php b/test/PHPMailer/DKIMTest.php index 34991846..c41afa1e 100644 --- a/test/PHPMailer/DKIMTest.php +++ b/test/PHPMailer/DKIMTest.php @@ -248,7 +248,7 @@ final class DKIMTest extends SendTestCase public function testDKIMSignOpenSSLNotAvailableException() { if (extension_loaded('openssl')) { - $this->markTestSkipped('Test requires OpenSSL *not* to be available'); + self::markTestSkipped('Test requires OpenSSL *not* to be available'); } $this->expectException(Exception::class); diff --git a/test/PHPMailer/DKIMWithoutExceptionsTest.php b/test/PHPMailer/DKIMWithoutExceptionsTest.php index 6e8429bb..4a7008b0 100644 --- a/test/PHPMailer/DKIMWithoutExceptionsTest.php +++ b/test/PHPMailer/DKIMWithoutExceptionsTest.php @@ -38,7 +38,7 @@ final class DKIMWithoutExceptionsTest extends TestCase public function testDKIMSignOpenSSLNotAvailable() { if (extension_loaded('openssl')) { - $this->markTestSkipped('Test requires OpenSSL *not* to be available'); + self::markTestSkipped('Test requires OpenSSL *not* to be available'); } $signature = $this->Mail->DKIM_Sign('foo'); diff --git a/test/PHPMailer/FileIsAccessibleTest.php b/test/PHPMailer/FileIsAccessibleTest.php index 1dfa2e21..8989643a 100644 --- a/test/PHPMailer/FileIsAccessibleTest.php +++ b/test/PHPMailer/FileIsAccessibleTest.php @@ -83,7 +83,7 @@ final class FileIsAccessibleTest extends TestCase { if (\DIRECTORY_SEPARATOR === '\\') { // Windows does not respect chmod permissions. - $this->markTestSkipped('This test requires a non-Windows OS.'); + self::markTestSkipped('This test requires a non-Windows OS.'); } $path = dirname(__DIR__) . '/Fixtures/FileIsAccessibleTest/'; diff --git a/test/PHPMailer/ParseAddressesTest.php b/test/PHPMailer/ParseAddressesTest.php index 9b20cb67..f6188b90 100644 --- a/test/PHPMailer/ParseAddressesTest.php +++ b/test/PHPMailer/ParseAddressesTest.php @@ -102,7 +102,7 @@ final class ParseAddressesTest extends TestCase public function testAddressSplittingNativeNoMbstring($addrstr, $expected, $charset = null) { if (extension_loaded('mbstring')) { - $this->markTestSkipped('Test requires MbString *not* to be available'); + self::markTestSkipped('Test requires MbString *not* to be available'); } if (isset($charset)) { @@ -136,7 +136,7 @@ final class ParseAddressesTest extends TestCase public function testAddressSplittingImapNoMbstring($addrstr, $expected, $charset = null) { if (extension_loaded('mbstring')) { - $this->markTestSkipped('Test requires MbString *not* to be available'); + self::markTestSkipped('Test requires MbString *not* to be available'); } if (isset($charset)) { diff --git a/test/PHPMailer/ReplyToGetSetClearTest.php b/test/PHPMailer/ReplyToGetSetClearTest.php index 97212b89..993abdd0 100644 --- a/test/PHPMailer/ReplyToGetSetClearTest.php +++ b/test/PHPMailer/ReplyToGetSetClearTest.php @@ -409,7 +409,7 @@ final class ReplyToGetSetClearTest extends PreSendTestCase public function testAddReplyToFailsOn8BitCharInDomainWithoutOptionalExtensions() { if (PHPMailer::idnSupported()) { - $this->markTestSkipped('Test requires MbString and/or Intl *not* to be available'); + self::markTestSkipped('Test requires MbString and/or Intl *not* to be available'); } self::assertFalse($this->Mail->addReplyTo('test@françois.ch')); diff --git a/test/PHPMailer/SetFromTest.php b/test/PHPMailer/SetFromTest.php index 8d46fb26..d1a8f2bd 100644 --- a/test/PHPMailer/SetFromTest.php +++ b/test/PHPMailer/SetFromTest.php @@ -194,7 +194,7 @@ final class SetFromTest extends TestCase public function testSetFromFailsOn8BitCharInDomainWithoutOptionalExtensions() { if (extension_loaded('mbstring') && function_exists('idn_to_ascii')) { - $this->markTestSkipped('Test requires MbString and/or Intl *not* to be available'); + self::markTestSkipped('Test requires MbString and/or Intl *not* to be available'); } $this->testSetFromFail("8bit@ex\x80mple.com"); diff --git a/test/POP3/PopBeforeSmtpTest.php b/test/POP3/PopBeforeSmtpTest.php index 3513ada9..5b3d4f06 100644 --- a/test/POP3/PopBeforeSmtpTest.php +++ b/test/POP3/PopBeforeSmtpTest.php @@ -52,7 +52,7 @@ final class PopBeforeSmtpTest extends TestCase protected function set_up() { if (DIRECTORY_SEPARATOR === '\\') { - $this->markTestSkipped('This test needs a non-Windows OS to run'); + self::markTestSkipped('This test needs a non-Windows OS to run'); } // Chdir to test directory as runfakepopserver.sh runs fakepopserver.sh