Merge remote-tracking branch 'remotes/upstream/master' into longlines
This commit is contained in:
commit
b83f2a6b6b
|
|
@ -6,6 +6,8 @@ Build status: [](h
|
|||
[](https://scrutinizer-ci.com/g/PHPMailer/PHPMailer/)
|
||||
[](https://scrutinizer-ci.com/g/PHPMailer/PHPMailer/)
|
||||
|
||||
[](https://packagist.org/packages/phpmailer/phpmailer) [](https://packagist.org/packages/phpmailer/phpmailer) [](https://packagist.org/packages/phpmailer/phpmailer) [](https://packagist.org/packages/phpmailer/phpmailer)
|
||||
|
||||
## Class Features
|
||||
|
||||
- Probably the world's most popular code for sending email from PHP!
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
* Improved checks and error messages for missing extensions
|
||||
* Store and report SMTP errors more consistently
|
||||
* Add MIME multipart preamble for better Outlook compatibility
|
||||
* Provide detailed errors when individual recipients fail
|
||||
|
||||
## Version 5.2.9 (Sept 25th 2014)
|
||||
* **Important: The autoloader is no longer autoloaded by the PHPMailer class**
|
||||
|
|
|
|||
|
|
@ -467,7 +467,7 @@ class PHPMailer
|
|||
|
||||
/**
|
||||
* An array of all kinds of addresses.
|
||||
* Includes all of $to, $cc, $bcc, $replyto
|
||||
* Includes all of $to, $cc, $bcc
|
||||
* @type array
|
||||
* @access protected
|
||||
*/
|
||||
|
|
@ -1248,32 +1248,17 @@ class PHPMailer
|
|||
}
|
||||
|
||||
// Attempt to send to all recipients
|
||||
foreach ($this->to as $to) {
|
||||
if (!$this->smtp->recipient($to[0])) {
|
||||
$bad_rcpt[] = $to[0];
|
||||
$isSent = false;
|
||||
} else {
|
||||
$isSent = true;
|
||||
foreach (array($this->to, $this->cc, $this->bcc) as $togroup) {
|
||||
foreach ($togroup as $to) {
|
||||
if (!$this->smtp->recipient($to[0])) {
|
||||
$error = $this->smtp->getError();
|
||||
$bad_rcpt[] = array('to' => $to[0], 'error' => $error['detail']);
|
||||
$isSent = false;
|
||||
} else {
|
||||
$isSent = true;
|
||||
}
|
||||
$this->doCallback($isSent, array($to[0]), array(), array(), $this->Subject, $body, $this->From);
|
||||
}
|
||||
$this->doCallback($isSent, array($to[0]), array(), array(), $this->Subject, $body, $this->From);
|
||||
}
|
||||
foreach ($this->cc as $cc) {
|
||||
if (!$this->smtp->recipient($cc[0])) {
|
||||
$bad_rcpt[] = $cc[0];
|
||||
$isSent = false;
|
||||
} else {
|
||||
$isSent = true;
|
||||
}
|
||||
$this->doCallback($isSent, array(), array($cc[0]), array(), $this->Subject, $body, $this->From);
|
||||
}
|
||||
foreach ($this->bcc as $bcc) {
|
||||
if (!$this->smtp->recipient($bcc[0])) {
|
||||
$bad_rcpt[] = $bcc[0];
|
||||
$isSent = false;
|
||||
} else {
|
||||
$isSent = true;
|
||||
}
|
||||
$this->doCallback($isSent, array(), array(), array($bcc[0]), $this->Subject, $body, $this->From);
|
||||
}
|
||||
|
||||
// Only send the DATA command if we have viable recipients
|
||||
|
|
@ -1288,8 +1273,12 @@ class PHPMailer
|
|||
}
|
||||
//Create error message for any bad addresses
|
||||
if (count($bad_rcpt) > 0) {
|
||||
$errstr = '';
|
||||
foreach ($bad_rcpt as $bad) {
|
||||
$errstr .= $bad['to'] . ': ' . $bad['error'];
|
||||
}
|
||||
throw new phpmailerException(
|
||||
$this->lang('recipients_failed') . implode(', ', $bad_rcpt),
|
||||
$this->lang('recipients_failed') . $errstr,
|
||||
self::STOP_CONTINUE
|
||||
);
|
||||
}
|
||||
|
|
@ -3449,8 +3438,8 @@ class PHPMailer
|
|||
$to_header = $header;
|
||||
$current = 'to_header';
|
||||
} else {
|
||||
if ($current && strpos($header, ' =?') === 0) {
|
||||
$current .= $header;
|
||||
if (!empty($$current) && strpos($header, ' =?') === 0) {
|
||||
$$current .= $header;
|
||||
} else {
|
||||
$current = '';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -130,8 +130,8 @@ class POP3
|
|||
/**
|
||||
* Simple static wrapper for all-in-one POP before SMTP
|
||||
* @param $host
|
||||
* @param boolean $port
|
||||
* @param boolean $tval
|
||||
* @param integer|boolean $port The port number to connect to
|
||||
* @param integer|boolean $timeout The timeout value
|
||||
* @param string $username
|
||||
* @param string $password
|
||||
* @param integer $debug_level
|
||||
|
|
@ -140,13 +140,13 @@ class POP3
|
|||
public static function popBeforeSmtp(
|
||||
$host,
|
||||
$port = false,
|
||||
$tval = false,
|
||||
$timeout = false,
|
||||
$username = '',
|
||||
$password = '',
|
||||
$debug_level = 0
|
||||
) {
|
||||
$pop = new POP3;
|
||||
return $pop->authorise($host, $port, $tval, $username, $password, $debug_level);
|
||||
return $pop->authorise($host, $port, $timeout, $username, $password, $debug_level);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -631,7 +631,7 @@ class SMTP
|
|||
if ($in_headers and $line == '') {
|
||||
$in_headers = false;
|
||||
}
|
||||
//We need to break this line up into several smaller lines
|
||||
//Break this line up into several smaller lines if it's too long
|
||||
//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
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<title>PHPMailer Test</title>
|
||||
</head>
|
||||
<body>
|
||||
<div style="width: 640px; font-family: Arial, Helvetica, sans-serif; font-size: 11px;">
|
||||
<h1>This is a test of PHPMailer.</h1>
|
||||
<div align="center">
|
||||
<a href="https://github.com/PHPMailer/PHPMailer/"><img src="images/phpmailer.png" height="90" width="340" alt="PHPMailer rocks"></a>
|
||||
</div>
|
||||
<p>This example uses <strong>HTML</strong>.</p>
|
||||
<p>The PHPMailer image at the top has been embedded automatically.</p>
|
||||
<div style="width: 640px; font-family: Arial, Helvetica, sans-serif; font-size: 11px;">
|
||||
<h1>This is a test of PHPMailer.</h1>
|
||||
<div align="center">
|
||||
<a href="https://github.com/PHPMailer/PHPMailer/"><img src="images/phpmailer.png" height="90" width="340" alt="PHPMailer rocks"></a>
|
||||
</div>
|
||||
<p>This example uses <strong>HTML</strong>.</p>
|
||||
<p>ISO-8859-1 text: éèîüçÅñæß</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>PHPMailer Test</title>
|
||||
</head>
|
||||
<body>
|
||||
<div style="width: 640px; font-family: Arial, Helvetica, sans-serif; font-size: 11px;">
|
||||
<h1>This is a test of PHPMailer.</h1>
|
||||
<div align="center">
|
||||
<a href="https://github.com/PHPMailer/PHPMailer/"><img src="images/phpmailer.png" height="90" width="340" alt="PHPMailer rocks"></a>
|
||||
</div>
|
||||
<p>This example uses <strong>HTML</strong>.</p>
|
||||
<p>Chinese text: 郵件內容為空</p>
|
||||
<p>Russian text: Пустое тело сообщения</p>
|
||||
<p>Armenian text: Հաղորդագրությունը դատարկ է</p>
|
||||
<p>Czech text: Prázdné tělo zprávy</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -23,4 +23,4 @@ $PHPMAILER_LANG['signing'] = 'Ստորագրման սխալ: ';
|
|||
$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP -ի connect() ֆունկցիան չի հաջողվել';
|
||||
$PHPMAILER_LANG['smtp_error'] = 'SMTP սերվերի սխալ: ';
|
||||
$PHPMAILER_LANG['variable_set'] = 'Չի հաջողվում ստեղծել կամ վերափոխել փոփոխականը: ';
|
||||
//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
|
||||
$PHPMAILER_LANG['extension_missing'] = 'Հավելվածը բացակայում է: ';
|
||||
|
|
|
|||
|
|
@ -23,4 +23,4 @@ $PHPMAILER_LANG['signing'] = 'Грешка при подписва
|
|||
$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP провален connect().';
|
||||
$PHPMAILER_LANG['smtp_error'] = 'SMTP сървърна грешка: ';
|
||||
$PHPMAILER_LANG['variable_set'] = 'Не може да се установи или възстанови променлива: ';
|
||||
//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: ';
|
||||
$PHPMAILER_LANG['extension_missing'] = 'Липсва разширение: ';
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
* @package PHPMailer
|
||||
*/
|
||||
|
||||
$PHPMAILER_LANG['authenticate'] = 'SMTP Feil: Kunne ikke authentisere.';
|
||||
$PHPMAILER_LANG['connect_host'] = 'SMTP Feil: Kunne ikke koble til SMTP host.';
|
||||
$PHPMAILER_LANG['authenticate'] = 'SMTP Feil: Kunne ikke autentisere.';
|
||||
$PHPMAILER_LANG['connect_host'] = 'SMTP Feil: Kunne ikke koble til SMTP tjener.';
|
||||
$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Feil: Data ble ikke akseptert.';
|
||||
$PHPMAILER_LANG['empty_message'] = 'Meldingsinnholdet er tomt';
|
||||
$PHPMAILER_LANG['encoding'] = 'Ukjent tegnkoding: ';
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ class PHPMailerTest extends PHPUnit_Framework_TestCase
|
|||
$eol = "<br>\r\n";
|
||||
$bullet_start = '<li>';
|
||||
$bullet_end = "</li>\r\n";
|
||||
$list_start = '<ul>\r\n';
|
||||
$list_start = "<ul>\r\n";
|
||||
$list_end = "</ul>\r\n";
|
||||
} else {
|
||||
$eol = "\r\n";
|
||||
|
|
@ -166,6 +166,7 @@ class PHPMailerTest extends PHPUnit_Framework_TestCase
|
|||
$ReportBody .= '---------------------' . $eol;
|
||||
$ReportBody .= 'phpmailer version: ' . $this->Mail->Version . $eol;
|
||||
$ReportBody .= 'Content Type: ' . $this->Mail->ContentType . $eol;
|
||||
$ReportBody .= 'CharSet: ' . $this->Mail->CharSet . $eol;
|
||||
|
||||
if (strlen($this->Mail->Host) > 0) {
|
||||
$ReportBody .= 'Host: ' . $this->Mail->Host . $eol;
|
||||
|
|
@ -210,7 +211,7 @@ class PHPMailerTest extends PHPUnit_Framework_TestCase
|
|||
}
|
||||
|
||||
// Re-attach the original body
|
||||
$this->Mail->Body .= $eol . $eol . $ReportBody;
|
||||
$this->Mail->Body .= $eol . $ReportBody;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -800,6 +801,29 @@ EOT;
|
|||
$this->assertNotContains("\r\n\r\nMIME-Version:", $msg, 'Incorrect MIME headers');
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a message containing ISO-8859-1 text.
|
||||
*/
|
||||
public function testHtmlIso8859()
|
||||
{
|
||||
$this->Mail->isHTML(false);
|
||||
$this->Mail->Subject .= ": ISO-8859-1 HTML";
|
||||
$this->Mail->CharSet = 'iso-8859-1';
|
||||
|
||||
//This file is in ISO-8859-1 charset
|
||||
//Needs to be external because this file is in UTF-8
|
||||
$content = file_get_contents('../examples/contents.html');
|
||||
//Make sure it really is in ISO-8859-1!
|
||||
$this->Mail->Body =
|
||||
mb_convert_encoding(
|
||||
$content,
|
||||
"ISO-8859-1",
|
||||
mb_detect_encoding($content, "UTF-8, ISO-8859-1, ISO-8859-15", true)
|
||||
);
|
||||
$this->buildBody();
|
||||
$this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a message containing multilingual UTF-8 text.
|
||||
*/
|
||||
|
|
@ -812,6 +836,7 @@ EOT;
|
|||
$this->Mail->Body = <<<EOT
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>HTML email test</title>
|
||||
</head>
|
||||
<body>
|
||||
|
|
@ -828,6 +853,41 @@ EOT;
|
|||
$this->assertNotContains("\r\n\r\nMIME-Version:", $msg, 'Incorrect MIME headers');
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a message containing multilingual UTF-8 text with an embedded image.
|
||||
*/
|
||||
public function testUtf8WithEmbeddedImage()
|
||||
{
|
||||
$this->Mail->isHTML(true);
|
||||
$this->Mail->Subject .= ": UTF-8 with embedded image";
|
||||
$this->Mail->CharSet = 'UTF-8';
|
||||
|
||||
$this->Mail->Body = <<<EOT
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>HTML email test</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Chinese text: 郵件內容為空</p>
|
||||
<p>Russian text: Пустое тело сообщения</p>
|
||||
<p>Armenian text: Հաղորդագրությունը դատարկ է</p>
|
||||
<p>Czech text: Prázdné tělo zprávy</p>
|
||||
Embedded Image: <img alt="phpmailer" src="cid:my-attach">
|
||||
</body>
|
||||
</html>
|
||||
EOT;
|
||||
$this->Mail->addEmbeddedImage(
|
||||
'../examples/images/phpmailer.png',
|
||||
'my-attach',
|
||||
'phpmailer.png',
|
||||
'base64',
|
||||
'image/png'
|
||||
);
|
||||
$this->buildBody();
|
||||
$this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a message containing multilingual UTF-8 text.
|
||||
*/
|
||||
|
|
@ -854,7 +914,7 @@ EOT;
|
|||
*/
|
||||
public function testMsgHTML()
|
||||
{
|
||||
$message = file_get_contents('../examples/contents.html');
|
||||
$message = file_get_contents('../examples/contentsutf8.html');
|
||||
$this->Mail->CharSet = 'utf-8';
|
||||
$this->Mail->Body = '';
|
||||
$this->Mail->AltBody = '';
|
||||
|
|
@ -904,7 +964,7 @@ EOT;
|
|||
public function testEmbeddedImage()
|
||||
{
|
||||
$this->Mail->Body = 'Embedded Image: <img alt="phpmailer" src="cid:my-attach">' .
|
||||
'Here is an image!</a>';
|
||||
'Here is an image!';
|
||||
$this->Mail->Subject .= ': Embedded Image';
|
||||
$this->Mail->isHTML(true);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue