diff --git a/class.phpmailer.php b/class.phpmailer.php index 543fd290f..a9f4eb43e 100644 --- a/class.phpmailer.php +++ b/class.phpmailer.php @@ -1806,9 +1806,7 @@ public function AddAttachment($path, $name = '', $encoding = 'base64', $type = ' if ($this->SMTPDebug) { $this->edebug($e->getMessage()."\n"); } - if ( $e->getCode() == self::STOP_CRITICAL ) { - return false; - } + return false; } return true; } diff --git a/test/phpmailerTest.php b/test/phpmailerTest.php index 5d7b0eba8..b72bb12dc 100644 --- a/test/phpmailerTest.php +++ b/test/phpmailerTest.php @@ -125,8 +125,9 @@ function tearDown() /** * Build the body of the message in the appropriate format. + * * @private - * @returns void + * @return void */ function BuildBody() { @@ -202,7 +203,7 @@ function BuildBody() /** * Check which default settings have been changed for the report. * @private - * @returns void + * @return void */ function CheckChanges() { @@ -769,6 +770,9 @@ function test_HTML_Attachment() return; } + //Make sure that trying to attach a nonexistent file fails + $this->assertFalse($this->Mail->AddAttachment(__FILE__.md5(microtime()), 'nonexistent_file.txt')); + $this->BuildBody(); $this->assertTrue($this->Mail->Send(), $this->Mail->ErrorInfo); }