mirror of
https://github.com/PHPMailer/PHPMailer.git
synced 2024-09-20 10:02:14 +02:00
parent
1ad1217759
commit
d7c44d5a9e
@ -1041,7 +1041,6 @@ class PHPMailer
|
||||
str_replace("\r\n", "\n", $header_dkim) . self::CRLF;
|
||||
}
|
||||
return true;
|
||||
|
||||
} catch (phpmailerException $exc) {
|
||||
$this->setError($exc->getMessage());
|
||||
if ($this->exceptions) {
|
||||
@ -1747,7 +1746,7 @@ class PHPMailer
|
||||
} else {
|
||||
$this->lastMessageID = sprintf('<%s@%s>', $uniq_id, $this->ServerHostname());
|
||||
}
|
||||
$result .= $this->HeaderLine('Message-ID', $this->lastMessageID);
|
||||
$result .= $this->headerLine('Message-ID', $this->lastMessageID);
|
||||
$result .= $this->headerLine('X-Priority', $this->Priority);
|
||||
if ($this->XMailer == '') {
|
||||
$result .= $this->headerLine(
|
||||
|
@ -628,7 +628,7 @@ class SMTP
|
||||
$in_headers = false;
|
||||
}
|
||||
//We need to break this line up into several smaller lines
|
||||
//This is a small micro-optimisation: isset($str[$len]) is equivalent to (strlen($str) > $len)
|
||||
//Micro-optimisation: isset($str[$len]) is faster than (strlen($str) > $len),
|
||||
while (isset($line[self::MAX_LINE_LENGTH])) {
|
||||
//Working backwards, try to find a space within the last MAX_LINE_LENGTH chars of the line to break on
|
||||
//so as to avoid breaking in the middle of a word
|
||||
|
@ -794,6 +794,8 @@ class PHPMailerTest extends PHPUnit_Framework_TestCase
|
||||
EOT;
|
||||
$this->buildBody();
|
||||
$this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
|
||||
$msg = $this->Mail->getSentMIMEMessage();
|
||||
$this->assertNotContains("\r\n\r\nMIME-Version:", $msg, 'Incorrect MIME headers');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1070,7 +1072,8 @@ EOT;
|
||||
public function testMailSend()
|
||||
{
|
||||
$sendmail = ini_get('sendmail_path');
|
||||
if (strpos($sendmail, '/') === false) { //No path in sendmail_path
|
||||
//No path in sendmail_path
|
||||
if (strpos($sendmail, '/') === false) {
|
||||
ini_set('sendmail_path', '/usr/sbin/sendmail -t -i ');
|
||||
}
|
||||
$this->Mail->Body = 'Sending via mail()';
|
||||
@ -1079,6 +1082,8 @@ EOT;
|
||||
$this->Mail->Subject = $this->Mail->Subject . ': mail()';
|
||||
$this->Mail->isMail();
|
||||
$this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
|
||||
$msg = $this->Mail->getSentMIMEMessage();
|
||||
$this->assertNotContains("\r\n\r\nMIME-Version:", $msg, 'Incorrect MIME headers');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1101,7 +1106,7 @@ EOT;
|
||||
*/
|
||||
public function testSmtpKeepAlive()
|
||||
{
|
||||
$this->Mail->Body = 'This was done using the SMTP keep-alive.';
|
||||
$this->Mail->Body = 'SMTP keep-alive test.';
|
||||
$this->buildBody();
|
||||
$subject = $this->Mail->Subject;
|
||||
|
||||
@ -1116,7 +1121,7 @@ EOT;
|
||||
|
||||
/**
|
||||
* Tests this denial of service attack:
|
||||
* http://www.cybsec.com/vuln/PHPMailer-DOS.pdf
|
||||
* @link http://www.cybsec.com/vuln/PHPMailer-DOS.pdf
|
||||
*/
|
||||
public function testDenialOfServiceAttack()
|
||||
{
|
||||
@ -1129,8 +1134,9 @@ EOT;
|
||||
|
||||
/**
|
||||
* Tests this denial of service attack:
|
||||
* https://sourceforge.net/p/phpmailer/bugs/383/
|
||||
* @link https://sourceforge.net/p/phpmailer/bugs/383/
|
||||
* According to the ticket, this should get stuck in a loop, though I can't make it happen.
|
||||
* @TODO No assertions in here - how can you assert for this?
|
||||
*/
|
||||
public function testDenialOfServiceAttack2()
|
||||
{
|
||||
@ -1261,6 +1267,7 @@ EOT;
|
||||
}
|
||||
/**
|
||||
* S/MIME Signing tests (self-signed).
|
||||
* @requires extension openssl
|
||||
*/
|
||||
public function testSigning()
|
||||
{
|
||||
@ -1305,6 +1312,9 @@ EOT;
|
||||
$password
|
||||
);
|
||||
$this->assertTrue($this->Mail->send(), 'S/MIME signing failed');
|
||||
|
||||
$msg = $this->Mail->getSentMIMEMessage();
|
||||
$this->assertNotContains("\r\n\r\nMIME-Version:", $msg, 'Incorrect MIME headers');
|
||||
unlink($certfile);
|
||||
unlink($keyfile);
|
||||
}
|
||||
@ -1314,6 +1324,7 @@ EOT;
|
||||
* To test that a generated message is signed correctly, save the message in a file
|
||||
* and use openssl along with the certs generated by this script:
|
||||
* `openssl smime -verify -in signed.eml -signer certfile.pem -CAfile cacertfile.pem`
|
||||
* @requires extension openssl
|
||||
*/
|
||||
public function testSigningWithCA()
|
||||
{
|
||||
@ -1393,6 +1404,7 @@ EOT;
|
||||
|
||||
/**
|
||||
* DKIM Signing tests.
|
||||
* @requires extension openssl
|
||||
*/
|
||||
public function testDKIM()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user