Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-inclu.../PHPMaile...
File: PHPMailer.php
if (false !== $punycode) {
[1500] Fix | Delete
return substr($address, 0, $pos) . $punycode;
[1501] Fix | Delete
}
[1502] Fix | Delete
}
[1503] Fix | Delete
}
[1504] Fix | Delete
[1505] Fix | Delete
return $address;
[1506] Fix | Delete
}
[1507] Fix | Delete
[1508] Fix | Delete
/**
[1509] Fix | Delete
* Create a message and send it.
[1510] Fix | Delete
* Uses the sending method specified by $Mailer.
[1511] Fix | Delete
*
[1512] Fix | Delete
* @throws Exception
[1513] Fix | Delete
*
[1514] Fix | Delete
* @return bool false on error - See the ErrorInfo property for details of the error
[1515] Fix | Delete
*/
[1516] Fix | Delete
public function send()
[1517] Fix | Delete
{
[1518] Fix | Delete
try {
[1519] Fix | Delete
if (!$this->preSend()) {
[1520] Fix | Delete
return false;
[1521] Fix | Delete
}
[1522] Fix | Delete
[1523] Fix | Delete
return $this->postSend();
[1524] Fix | Delete
} catch (Exception $exc) {
[1525] Fix | Delete
$this->mailHeader = '';
[1526] Fix | Delete
$this->setError($exc->getMessage());
[1527] Fix | Delete
if ($this->exceptions) {
[1528] Fix | Delete
throw $exc;
[1529] Fix | Delete
}
[1530] Fix | Delete
[1531] Fix | Delete
return false;
[1532] Fix | Delete
}
[1533] Fix | Delete
}
[1534] Fix | Delete
[1535] Fix | Delete
/**
[1536] Fix | Delete
* Prepare a message for sending.
[1537] Fix | Delete
*
[1538] Fix | Delete
* @throws Exception
[1539] Fix | Delete
*
[1540] Fix | Delete
* @return bool
[1541] Fix | Delete
*/
[1542] Fix | Delete
public function preSend()
[1543] Fix | Delete
{
[1544] Fix | Delete
if (
[1545] Fix | Delete
'smtp' === $this->Mailer
[1546] Fix | Delete
|| ('mail' === $this->Mailer && (\PHP_VERSION_ID >= 80000 || stripos(PHP_OS, 'WIN') === 0))
[1547] Fix | Delete
) {
[1548] Fix | Delete
//SMTP mandates RFC-compliant line endings
[1549] Fix | Delete
//and it's also used with mail() on Windows
[1550] Fix | Delete
static::setLE(self::CRLF);
[1551] Fix | Delete
} else {
[1552] Fix | Delete
//Maintain backward compatibility with legacy Linux command line mailers
[1553] Fix | Delete
static::setLE(PHP_EOL);
[1554] Fix | Delete
}
[1555] Fix | Delete
//Check for buggy PHP versions that add a header with an incorrect line break
[1556] Fix | Delete
if (
[1557] Fix | Delete
'mail' === $this->Mailer
[1558] Fix | Delete
&& ((\PHP_VERSION_ID >= 70000 && \PHP_VERSION_ID < 70017)
[1559] Fix | Delete
|| (\PHP_VERSION_ID >= 70100 && \PHP_VERSION_ID < 70103))
[1560] Fix | Delete
&& ini_get('mail.add_x_header') === '1'
[1561] Fix | Delete
&& stripos(PHP_OS, 'WIN') === 0
[1562] Fix | Delete
) {
[1563] Fix | Delete
trigger_error($this->lang('buggy_php'), E_USER_WARNING);
[1564] Fix | Delete
}
[1565] Fix | Delete
[1566] Fix | Delete
try {
[1567] Fix | Delete
$this->error_count = 0; //Reset errors
[1568] Fix | Delete
$this->mailHeader = '';
[1569] Fix | Delete
[1570] Fix | Delete
//Dequeue recipient and Reply-To addresses with IDN
[1571] Fix | Delete
foreach (array_merge($this->RecipientsQueue, $this->ReplyToQueue) as $params) {
[1572] Fix | Delete
$params[1] = $this->punyencodeAddress($params[1]);
[1573] Fix | Delete
call_user_func_array([$this, 'addAnAddress'], $params);
[1574] Fix | Delete
}
[1575] Fix | Delete
if (count($this->to) + count($this->cc) + count($this->bcc) < 1) {
[1576] Fix | Delete
throw new Exception($this->lang('provide_address'), self::STOP_CRITICAL);
[1577] Fix | Delete
}
[1578] Fix | Delete
[1579] Fix | Delete
//Validate From, Sender, and ConfirmReadingTo addresses
[1580] Fix | Delete
foreach (['From', 'Sender', 'ConfirmReadingTo'] as $address_kind) {
[1581] Fix | Delete
if ($this->{$address_kind} === null) {
[1582] Fix | Delete
$this->{$address_kind} = '';
[1583] Fix | Delete
continue;
[1584] Fix | Delete
}
[1585] Fix | Delete
$this->{$address_kind} = trim($this->{$address_kind});
[1586] Fix | Delete
if (empty($this->{$address_kind})) {
[1587] Fix | Delete
continue;
[1588] Fix | Delete
}
[1589] Fix | Delete
$this->{$address_kind} = $this->punyencodeAddress($this->{$address_kind});
[1590] Fix | Delete
if (!static::validateAddress($this->{$address_kind})) {
[1591] Fix | Delete
$error_message = sprintf(
[1592] Fix | Delete
'%s (%s): %s',
[1593] Fix | Delete
$this->lang('invalid_address'),
[1594] Fix | Delete
$address_kind,
[1595] Fix | Delete
$this->{$address_kind}
[1596] Fix | Delete
);
[1597] Fix | Delete
$this->setError($error_message);
[1598] Fix | Delete
$this->edebug($error_message);
[1599] Fix | Delete
if ($this->exceptions) {
[1600] Fix | Delete
throw new Exception($error_message);
[1601] Fix | Delete
}
[1602] Fix | Delete
[1603] Fix | Delete
return false;
[1604] Fix | Delete
}
[1605] Fix | Delete
}
[1606] Fix | Delete
[1607] Fix | Delete
//Set whether the message is multipart/alternative
[1608] Fix | Delete
if ($this->alternativeExists()) {
[1609] Fix | Delete
$this->ContentType = static::CONTENT_TYPE_MULTIPART_ALTERNATIVE;
[1610] Fix | Delete
}
[1611] Fix | Delete
[1612] Fix | Delete
$this->setMessageType();
[1613] Fix | Delete
//Refuse to send an empty message unless we are specifically allowing it
[1614] Fix | Delete
if (!$this->AllowEmpty && empty($this->Body)) {
[1615] Fix | Delete
throw new Exception($this->lang('empty_message'), self::STOP_CRITICAL);
[1616] Fix | Delete
}
[1617] Fix | Delete
[1618] Fix | Delete
//Trim subject consistently
[1619] Fix | Delete
$this->Subject = trim($this->Subject);
[1620] Fix | Delete
//Create body before headers in case body makes changes to headers (e.g. altering transfer encoding)
[1621] Fix | Delete
$this->MIMEHeader = '';
[1622] Fix | Delete
$this->MIMEBody = $this->createBody();
[1623] Fix | Delete
//createBody may have added some headers, so retain them
[1624] Fix | Delete
$tempheaders = $this->MIMEHeader;
[1625] Fix | Delete
$this->MIMEHeader = $this->createHeader();
[1626] Fix | Delete
$this->MIMEHeader .= $tempheaders;
[1627] Fix | Delete
[1628] Fix | Delete
//To capture the complete message when using mail(), create
[1629] Fix | Delete
//an extra header list which createHeader() doesn't fold in
[1630] Fix | Delete
if ('mail' === $this->Mailer) {
[1631] Fix | Delete
if (count($this->to) > 0) {
[1632] Fix | Delete
$this->mailHeader .= $this->addrAppend('To', $this->to);
[1633] Fix | Delete
} else {
[1634] Fix | Delete
$this->mailHeader .= $this->headerLine('To', 'undisclosed-recipients:;');
[1635] Fix | Delete
}
[1636] Fix | Delete
$this->mailHeader .= $this->headerLine(
[1637] Fix | Delete
'Subject',
[1638] Fix | Delete
$this->encodeHeader($this->secureHeader($this->Subject))
[1639] Fix | Delete
);
[1640] Fix | Delete
}
[1641] Fix | Delete
[1642] Fix | Delete
//Sign with DKIM if enabled
[1643] Fix | Delete
if (
[1644] Fix | Delete
!empty($this->DKIM_domain)
[1645] Fix | Delete
&& !empty($this->DKIM_selector)
[1646] Fix | Delete
&& (!empty($this->DKIM_private_string)
[1647] Fix | Delete
|| (!empty($this->DKIM_private)
[1648] Fix | Delete
&& static::isPermittedPath($this->DKIM_private)
[1649] Fix | Delete
&& file_exists($this->DKIM_private)
[1650] Fix | Delete
)
[1651] Fix | Delete
)
[1652] Fix | Delete
) {
[1653] Fix | Delete
$header_dkim = $this->DKIM_Add(
[1654] Fix | Delete
$this->MIMEHeader . $this->mailHeader,
[1655] Fix | Delete
$this->encodeHeader($this->secureHeader($this->Subject)),
[1656] Fix | Delete
$this->MIMEBody
[1657] Fix | Delete
);
[1658] Fix | Delete
$this->MIMEHeader = static::stripTrailingWSP($this->MIMEHeader) . static::$LE .
[1659] Fix | Delete
static::normalizeBreaks($header_dkim) . static::$LE;
[1660] Fix | Delete
}
[1661] Fix | Delete
[1662] Fix | Delete
return true;
[1663] Fix | Delete
} catch (Exception $exc) {
[1664] Fix | Delete
$this->setError($exc->getMessage());
[1665] Fix | Delete
if ($this->exceptions) {
[1666] Fix | Delete
throw $exc;
[1667] Fix | Delete
}
[1668] Fix | Delete
[1669] Fix | Delete
return false;
[1670] Fix | Delete
}
[1671] Fix | Delete
}
[1672] Fix | Delete
[1673] Fix | Delete
/**
[1674] Fix | Delete
* Actually send a message via the selected mechanism.
[1675] Fix | Delete
*
[1676] Fix | Delete
* @throws Exception
[1677] Fix | Delete
*
[1678] Fix | Delete
* @return bool
[1679] Fix | Delete
*/
[1680] Fix | Delete
public function postSend()
[1681] Fix | Delete
{
[1682] Fix | Delete
try {
[1683] Fix | Delete
//Choose the mailer and send through it
[1684] Fix | Delete
switch ($this->Mailer) {
[1685] Fix | Delete
case 'sendmail':
[1686] Fix | Delete
case 'qmail':
[1687] Fix | Delete
return $this->sendmailSend($this->MIMEHeader, $this->MIMEBody);
[1688] Fix | Delete
case 'smtp':
[1689] Fix | Delete
return $this->smtpSend($this->MIMEHeader, $this->MIMEBody);
[1690] Fix | Delete
case 'mail':
[1691] Fix | Delete
return $this->mailSend($this->MIMEHeader, $this->MIMEBody);
[1692] Fix | Delete
default:
[1693] Fix | Delete
$sendMethod = $this->Mailer . 'Send';
[1694] Fix | Delete
if (method_exists($this, $sendMethod)) {
[1695] Fix | Delete
return $this->{$sendMethod}($this->MIMEHeader, $this->MIMEBody);
[1696] Fix | Delete
}
[1697] Fix | Delete
[1698] Fix | Delete
return $this->mailSend($this->MIMEHeader, $this->MIMEBody);
[1699] Fix | Delete
}
[1700] Fix | Delete
} catch (Exception $exc) {
[1701] Fix | Delete
$this->setError($exc->getMessage());
[1702] Fix | Delete
$this->edebug($exc->getMessage());
[1703] Fix | Delete
if ($this->Mailer === 'smtp' && $this->SMTPKeepAlive == true && $this->smtp->connected()) {
[1704] Fix | Delete
$this->smtp->reset();
[1705] Fix | Delete
}
[1706] Fix | Delete
if ($this->exceptions) {
[1707] Fix | Delete
throw $exc;
[1708] Fix | Delete
}
[1709] Fix | Delete
}
[1710] Fix | Delete
[1711] Fix | Delete
return false;
[1712] Fix | Delete
}
[1713] Fix | Delete
[1714] Fix | Delete
/**
[1715] Fix | Delete
* Send mail using the $Sendmail program.
[1716] Fix | Delete
*
[1717] Fix | Delete
* @see PHPMailer::$Sendmail
[1718] Fix | Delete
*
[1719] Fix | Delete
* @param string $header The message headers
[1720] Fix | Delete
* @param string $body The message body
[1721] Fix | Delete
*
[1722] Fix | Delete
* @throws Exception
[1723] Fix | Delete
*
[1724] Fix | Delete
* @return bool
[1725] Fix | Delete
*/
[1726] Fix | Delete
protected function sendmailSend($header, $body)
[1727] Fix | Delete
{
[1728] Fix | Delete
if ($this->Mailer === 'qmail') {
[1729] Fix | Delete
$this->edebug('Sending with qmail');
[1730] Fix | Delete
} else {
[1731] Fix | Delete
$this->edebug('Sending with sendmail');
[1732] Fix | Delete
}
[1733] Fix | Delete
$header = static::stripTrailingWSP($header) . static::$LE . static::$LE;
[1734] Fix | Delete
//This sets the SMTP envelope sender which gets turned into a return-path header by the receiver
[1735] Fix | Delete
//A space after `-f` is optional, but there is a long history of its presence
[1736] Fix | Delete
//causing problems, so we don't use one
[1737] Fix | Delete
//Exim docs: http://www.exim.org/exim-html-current/doc/html/spec_html/ch-the_exim_command_line.html
[1738] Fix | Delete
//Sendmail docs: http://www.sendmail.org/~ca/email/man/sendmail.html
[1739] Fix | Delete
//Qmail docs: http://www.qmail.org/man/man8/qmail-inject.html
[1740] Fix | Delete
//Example problem: https://www.drupal.org/node/1057954
[1741] Fix | Delete
[1742] Fix | Delete
//PHP 5.6 workaround
[1743] Fix | Delete
$sendmail_from_value = ini_get('sendmail_from');
[1744] Fix | Delete
if (empty($this->Sender) && !empty($sendmail_from_value)) {
[1745] Fix | Delete
//PHP config has a sender address we can use
[1746] Fix | Delete
$this->Sender = ini_get('sendmail_from');
[1747] Fix | Delete
}
[1748] Fix | Delete
//CVE-2016-10033, CVE-2016-10045: Don't pass -f if characters will be escaped.
[1749] Fix | Delete
if (!empty($this->Sender) && static::validateAddress($this->Sender) && self::isShellSafe($this->Sender)) {
[1750] Fix | Delete
if ($this->Mailer === 'qmail') {
[1751] Fix | Delete
$sendmailFmt = '%s -f%s';
[1752] Fix | Delete
} else {
[1753] Fix | Delete
$sendmailFmt = '%s -oi -f%s -t';
[1754] Fix | Delete
}
[1755] Fix | Delete
} else {
[1756] Fix | Delete
//allow sendmail to choose a default envelope sender. It may
[1757] Fix | Delete
//seem preferable to force it to use the From header as with
[1758] Fix | Delete
//SMTP, but that introduces new problems (see
[1759] Fix | Delete
//<https://github.com/PHPMailer/PHPMailer/issues/2298>), and
[1760] Fix | Delete
//it has historically worked this way.
[1761] Fix | Delete
$sendmailFmt = '%s -oi -t';
[1762] Fix | Delete
}
[1763] Fix | Delete
[1764] Fix | Delete
$sendmail = sprintf($sendmailFmt, escapeshellcmd($this->Sendmail), $this->Sender);
[1765] Fix | Delete
$this->edebug('Sendmail path: ' . $this->Sendmail);
[1766] Fix | Delete
$this->edebug('Sendmail command: ' . $sendmail);
[1767] Fix | Delete
$this->edebug('Envelope sender: ' . $this->Sender);
[1768] Fix | Delete
$this->edebug("Headers: {$header}");
[1769] Fix | Delete
[1770] Fix | Delete
if ($this->SingleTo) {
[1771] Fix | Delete
foreach ($this->SingleToArray as $toAddr) {
[1772] Fix | Delete
$mail = @popen($sendmail, 'w');
[1773] Fix | Delete
if (!$mail) {
[1774] Fix | Delete
throw new Exception($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
[1775] Fix | Delete
}
[1776] Fix | Delete
$this->edebug("To: {$toAddr}");
[1777] Fix | Delete
fwrite($mail, 'To: ' . $toAddr . "\n");
[1778] Fix | Delete
fwrite($mail, $header);
[1779] Fix | Delete
fwrite($mail, $body);
[1780] Fix | Delete
$result = pclose($mail);
[1781] Fix | Delete
$addrinfo = static::parseAddresses($toAddr, true, $this->CharSet);
[1782] Fix | Delete
$this->doCallback(
[1783] Fix | Delete
($result === 0),
[1784] Fix | Delete
[[$addrinfo['address'], $addrinfo['name']]],
[1785] Fix | Delete
$this->cc,
[1786] Fix | Delete
$this->bcc,
[1787] Fix | Delete
$this->Subject,
[1788] Fix | Delete
$body,
[1789] Fix | Delete
$this->From,
[1790] Fix | Delete
[]
[1791] Fix | Delete
);
[1792] Fix | Delete
$this->edebug("Result: " . ($result === 0 ? 'true' : 'false'));
[1793] Fix | Delete
if (0 !== $result) {
[1794] Fix | Delete
throw new Exception($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
[1795] Fix | Delete
}
[1796] Fix | Delete
}
[1797] Fix | Delete
} else {
[1798] Fix | Delete
$mail = @popen($sendmail, 'w');
[1799] Fix | Delete
if (!$mail) {
[1800] Fix | Delete
throw new Exception($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
[1801] Fix | Delete
}
[1802] Fix | Delete
fwrite($mail, $header);
[1803] Fix | Delete
fwrite($mail, $body);
[1804] Fix | Delete
$result = pclose($mail);
[1805] Fix | Delete
$this->doCallback(
[1806] Fix | Delete
($result === 0),
[1807] Fix | Delete
$this->to,
[1808] Fix | Delete
$this->cc,
[1809] Fix | Delete
$this->bcc,
[1810] Fix | Delete
$this->Subject,
[1811] Fix | Delete
$body,
[1812] Fix | Delete
$this->From,
[1813] Fix | Delete
[]
[1814] Fix | Delete
);
[1815] Fix | Delete
$this->edebug("Result: " . ($result === 0 ? 'true' : 'false'));
[1816] Fix | Delete
if (0 !== $result) {
[1817] Fix | Delete
throw new Exception($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
[1818] Fix | Delete
}
[1819] Fix | Delete
}
[1820] Fix | Delete
[1821] Fix | Delete
return true;
[1822] Fix | Delete
}
[1823] Fix | Delete
[1824] Fix | Delete
/**
[1825] Fix | Delete
* Fix CVE-2016-10033 and CVE-2016-10045 by disallowing potentially unsafe shell characters.
[1826] Fix | Delete
* Note that escapeshellarg and escapeshellcmd are inadequate for our purposes, especially on Windows.
[1827] Fix | Delete
*
[1828] Fix | Delete
* @see https://github.com/PHPMailer/PHPMailer/issues/924 CVE-2016-10045 bug report
[1829] Fix | Delete
*
[1830] Fix | Delete
* @param string $string The string to be validated
[1831] Fix | Delete
*
[1832] Fix | Delete
* @return bool
[1833] Fix | Delete
*/
[1834] Fix | Delete
protected static function isShellSafe($string)
[1835] Fix | Delete
{
[1836] Fix | Delete
//It's not possible to use shell commands safely (which includes the mail() function) without escapeshellarg,
[1837] Fix | Delete
//but some hosting providers disable it, creating a security problem that we don't want to have to deal with,
[1838] Fix | Delete
//so we don't.
[1839] Fix | Delete
if (!function_exists('escapeshellarg') || !function_exists('escapeshellcmd')) {
[1840] Fix | Delete
return false;
[1841] Fix | Delete
}
[1842] Fix | Delete
[1843] Fix | Delete
if (
[1844] Fix | Delete
escapeshellcmd($string) !== $string
[1845] Fix | Delete
|| !in_array(escapeshellarg($string), ["'$string'", "\"$string\""])
[1846] Fix | Delete
) {
[1847] Fix | Delete
return false;
[1848] Fix | Delete
}
[1849] Fix | Delete
[1850] Fix | Delete
$length = strlen($string);
[1851] Fix | Delete
[1852] Fix | Delete
for ($i = 0; $i < $length; ++$i) {
[1853] Fix | Delete
$c = $string[$i];
[1854] Fix | Delete
[1855] Fix | Delete
//All other characters have a special meaning in at least one common shell, including = and +.
[1856] Fix | Delete
//Full stop (.) has a special meaning in cmd.exe, but its impact should be negligible here.
[1857] Fix | Delete
//Note that this does permit non-Latin alphanumeric characters based on the current locale.
[1858] Fix | Delete
if (!ctype_alnum($c) && strpos('@_-.', $c) === false) {
[1859] Fix | Delete
return false;
[1860] Fix | Delete
}
[1861] Fix | Delete
}
[1862] Fix | Delete
[1863] Fix | Delete
return true;
[1864] Fix | Delete
}
[1865] Fix | Delete
[1866] Fix | Delete
/**
[1867] Fix | Delete
* Check whether a file path is of a permitted type.
[1868] Fix | Delete
* Used to reject URLs and phar files from functions that access local file paths,
[1869] Fix | Delete
* such as addAttachment.
[1870] Fix | Delete
*
[1871] Fix | Delete
* @param string $path A relative or absolute path to a file
[1872] Fix | Delete
*
[1873] Fix | Delete
* @return bool
[1874] Fix | Delete
*/
[1875] Fix | Delete
protected static function isPermittedPath($path)
[1876] Fix | Delete
{
[1877] Fix | Delete
//Matches scheme definition from https://tools.ietf.org/html/rfc3986#section-3.1
[1878] Fix | Delete
return !preg_match('#^[a-z][a-z\d+.-]*://#i', $path);
[1879] Fix | Delete
}
[1880] Fix | Delete
[1881] Fix | Delete
/**
[1882] Fix | Delete
* Check whether a file path is safe, accessible, and readable.
[1883] Fix | Delete
*
[1884] Fix | Delete
* @param string $path A relative or absolute path to a file
[1885] Fix | Delete
*
[1886] Fix | Delete
* @return bool
[1887] Fix | Delete
*/
[1888] Fix | Delete
protected static function fileIsAccessible($path)
[1889] Fix | Delete
{
[1890] Fix | Delete
if (!static::isPermittedPath($path)) {
[1891] Fix | Delete
return false;
[1892] Fix | Delete
}
[1893] Fix | Delete
$readable = is_file($path);
[1894] Fix | Delete
//If not a UNC path (expected to start with \\), check read permission, see #2069
[1895] Fix | Delete
if (strpos($path, '\\\\') !== 0) {
[1896] Fix | Delete
$readable = $readable && is_readable($path);
[1897] Fix | Delete
}
[1898] Fix | Delete
return $readable;
[1899] Fix | Delete
}
[1900] Fix | Delete
[1901] Fix | Delete
/**
[1902] Fix | Delete
* Send mail using the PHP mail() function.
[1903] Fix | Delete
*
[1904] Fix | Delete
* @see http://www.php.net/manual/en/book.mail.php
[1905] Fix | Delete
*
[1906] Fix | Delete
* @param string $header The message headers
[1907] Fix | Delete
* @param string $body The message body
[1908] Fix | Delete
*
[1909] Fix | Delete
* @throws Exception
[1910] Fix | Delete
*
[1911] Fix | Delete
* @return bool
[1912] Fix | Delete
*/
[1913] Fix | Delete
protected function mailSend($header, $body)
[1914] Fix | Delete
{
[1915] Fix | Delete
$header = static::stripTrailingWSP($header) . static::$LE . static::$LE;
[1916] Fix | Delete
[1917] Fix | Delete
$toArr = [];
[1918] Fix | Delete
foreach ($this->to as $toaddr) {
[1919] Fix | Delete
$toArr[] = $this->addrFormat($toaddr);
[1920] Fix | Delete
}
[1921] Fix | Delete
$to = trim(implode(', ', $toArr));
[1922] Fix | Delete
[1923] Fix | Delete
//If there are no To-addresses (e.g. when sending only to BCC-addresses)
[1924] Fix | Delete
//the following should be added to get a correct DKIM-signature.
[1925] Fix | Delete
//Compare with $this->preSend()
[1926] Fix | Delete
if ($to === '') {
[1927] Fix | Delete
$to = 'undisclosed-recipients:;';
[1928] Fix | Delete
}
[1929] Fix | Delete
[1930] Fix | Delete
$params = null;
[1931] Fix | Delete
//This sets the SMTP envelope sender which gets turned into a return-path header by the receiver
[1932] Fix | Delete
//A space after `-f` is optional, but there is a long history of its presence
[1933] Fix | Delete
//causing problems, so we don't use one
[1934] Fix | Delete
//Exim docs: http://www.exim.org/exim-html-current/doc/html/spec_html/ch-the_exim_command_line.html
[1935] Fix | Delete
//Sendmail docs: http://www.sendmail.org/~ca/email/man/sendmail.html
[1936] Fix | Delete
//Qmail docs: http://www.qmail.org/man/man8/qmail-inject.html
[1937] Fix | Delete
//Example problem: https://www.drupal.org/node/1057954
[1938] Fix | Delete
//CVE-2016-10033, CVE-2016-10045: Don't pass -f if characters will be escaped.
[1939] Fix | Delete
[1940] Fix | Delete
//PHP 5.6 workaround
[1941] Fix | Delete
$sendmail_from_value = ini_get('sendmail_from');
[1942] Fix | Delete
if (empty($this->Sender) && !empty($sendmail_from_value)) {
[1943] Fix | Delete
//PHP config has a sender address we can use
[1944] Fix | Delete
$this->Sender = ini_get('sendmail_from');
[1945] Fix | Delete
}
[1946] Fix | Delete
if (!empty($this->Sender) && static::validateAddress($this->Sender)) {
[1947] Fix | Delete
if (self::isShellSafe($this->Sender)) {
[1948] Fix | Delete
$params = sprintf('-f%s', $this->Sender);
[1949] Fix | Delete
}
[1950] Fix | Delete
$old_from = ini_get('sendmail_from');
[1951] Fix | Delete
ini_set('sendmail_from', $this->Sender);
[1952] Fix | Delete
}
[1953] Fix | Delete
$result = false;
[1954] Fix | Delete
if ($this->SingleTo && count($toArr) > 1) {
[1955] Fix | Delete
foreach ($toArr as $toAddr) {
[1956] Fix | Delete
$result = $this->mailPassthru($toAddr, $this->Subject, $body, $header, $params);
[1957] Fix | Delete
$addrinfo = static::parseAddresses($toAddr, true, $this->CharSet);
[1958] Fix | Delete
$this->doCallback(
[1959] Fix | Delete
$result,
[1960] Fix | Delete
[[$addrinfo['address'], $addrinfo['name']]],
[1961] Fix | Delete
$this->cc,
[1962] Fix | Delete
$this->bcc,
[1963] Fix | Delete
$this->Subject,
[1964] Fix | Delete
$body,
[1965] Fix | Delete
$this->From,
[1966] Fix | Delete
[]
[1967] Fix | Delete
);
[1968] Fix | Delete
}
[1969] Fix | Delete
} else {
[1970] Fix | Delete
$result = $this->mailPassthru($to, $this->Subject, $body, $header, $params);
[1971] Fix | Delete
$this->doCallback($result, $this->to, $this->cc, $this->bcc, $this->Subject, $body, $this->From, []);
[1972] Fix | Delete
}
[1973] Fix | Delete
if (isset($old_from)) {
[1974] Fix | Delete
ini_set('sendmail_from', $old_from);
[1975] Fix | Delete
}
[1976] Fix | Delete
if (!$result) {
[1977] Fix | Delete
throw new Exception($this->lang('instantiate'), self::STOP_CRITICAL);
[1978] Fix | Delete
}
[1979] Fix | Delete
[1980] Fix | Delete
return true;
[1981] Fix | Delete
}
[1982] Fix | Delete
[1983] Fix | Delete
/**
[1984] Fix | Delete
* Get an instance to use for SMTP operations.
[1985] Fix | Delete
* Override this function to load your own SMTP implementation,
[1986] Fix | Delete
* or set one with setSMTPInstance.
[1987] Fix | Delete
*
[1988] Fix | Delete
* @return SMTP
[1989] Fix | Delete
*/
[1990] Fix | Delete
public function getSMTPInstance()
[1991] Fix | Delete
{
[1992] Fix | Delete
if (!is_object($this->smtp)) {
[1993] Fix | Delete
$this->smtp = new SMTP();
[1994] Fix | Delete
}
[1995] Fix | Delete
[1996] Fix | Delete
return $this->smtp;
[1997] Fix | Delete
}
[1998] Fix | Delete
[1999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function