167 self::ICAL_METHOD_REQUEST,
168 self::ICAL_METHOD_PUBLISH,
169 self::ICAL_METHOD_REPLY,
170 self::ICAL_METHOD_ADD,
171 self::ICAL_METHOD_CANCEL,
172 self::ICAL_METHOD_REFRESH,
173 self::ICAL_METHOD_COUNTER,
174 self::ICAL_METHOD_DECLINECOUNTER,
787 protected static $LE = self::CRLF;
827 $this->Debugoutput = (strpos(PHP_SAPI,
'cli') !==
false ?
'echo' :
'html');
856 if (ini_get(
'mbstring.func_overload') & 1) {
862 if (0 == strlen(
$to) && strpos(
$header,
'To: undisclosed-recipients:;') !==
false) {
863 $to =
'undisclosed-recipients:;';
864 $header = preg_replace(
'/To: undisclosed-recipients:;(\s*)/',
'',
$header);
868 if (!$this->UseSendmailOptions || null ===
$params) {
888 if ($this->SMTPDebug <= 0) {
892 if ($this->Debugoutput instanceof \
Psr\Log\LoggerInterface) {
893 $this->Debugoutput->debug($str);
898 if (is_callable($this->Debugoutput) && !in_array($this->Debugoutput, [
'error_log',
'html',
'echo'])) {
899 call_user_func($this->Debugoutput, $str, $this->SMTPDebug);
903 switch ($this->Debugoutput) {
911 preg_replace(
'/[\r\n]+/',
'', $str),
919 $str = preg_replace(
'/\r\n|\r/m',
"\n", $str);
920 echo gmdate(
'Y-m-d H:i:s'),
943 $this->ContentType = static::CONTENT_TYPE_TEXT_HTML;
945 $this->ContentType = static::CONTENT_TYPE_PLAINTEXT;
954 $this->Mailer =
'smtp';
962 $this->Mailer =
'mail';
970 $ini_sendmail_path = ini_get(
'sendmail_path');
972 if (
false === stripos($ini_sendmail_path,
'sendmail')) {
973 $this->Sendmail =
'/usr/sbin/sendmail';
975 $this->Sendmail = $ini_sendmail_path;
977 $this->Mailer =
'sendmail';
985 $ini_sendmail_path = ini_get(
'sendmail_path');
987 if (
false === stripos($ini_sendmail_path,
'qmail')) {
988 $this->Sendmail =
'/var/qmail/bin/qmail-inject';
990 $this->Sendmail = $ini_sendmail_path;
992 $this->Mailer =
'qmail';
1071 $address = trim($address);
1072 $name = trim(preg_replace(
'/[\r\n]+/',
'',
$name));
1073 $pos = strrpos($address,
'@');
1074 if (
false === $pos) {
1076 $error_message = sprintf(
1078 $this->
lang(
'invalid_address'),
1083 $this->
edebug($error_message);
1084 if ($this->exceptions) {
1092 if (static::idnSupported() && $this->
has8bitChars(substr($address, ++$pos))) {
1093 if (
'Reply-To' !== $kind) {
1094 if (!array_key_exists($address, $this->RecipientsQueue)) {
1095 $this->RecipientsQueue[$address] =
$params;
1099 } elseif (!array_key_exists($address, $this->ReplyToQueue)) {
1100 $this->ReplyToQueue[$address] =
$params;
1109 return call_user_func_array([$this,
'addAnAddress'],
$params);
1126 if (!in_array($kind, [
'to',
'cc',
'bcc',
'Reply-To'])) {
1127 $error_message = sprintf(
1129 $this->
lang(
'Invalid recipient kind'),
1133 $this->
edebug($error_message);
1134 if ($this->exceptions) {
1140 if (!static::validateAddress($address)) {
1141 $error_message = sprintf(
1143 $this->
lang(
'invalid_address'),
1148 $this->
edebug($error_message);
1149 if ($this->exceptions) {
1155 if (
'Reply-To' !== $kind) {
1156 if (!array_key_exists(strtolower($address), $this->all_recipients)) {
1157 $this->{$kind}[] = [$address,
$name];
1158 $this->all_recipients[strtolower($address)] =
true;
1162 } elseif (!array_key_exists(strtolower($address), $this->ReplyTo)) {
1163 $this->ReplyTo[strtolower($address)] = [$address,
$name];
1187 if ($useimap && function_exists(
'imap_rfc822_parse_adrlist')) {
1189 $list = imap_rfc822_parse_adrlist($addrstr,
'');
1190 foreach (
$list as $address) {
1191 if ((
'.SYNTAX-ERROR.' !== $address->host) && static::validateAddress(
1192 $address->mailbox .
'@' . $address->host
1195 'name' => (property_exists($address,
'personal') ? $address->personal :
''),
1196 'address' => $address->mailbox .
'@' . $address->host,
1202 $list = explode(
',', $addrstr);
1203 foreach (
$list as $address) {
1204 $address = trim($address);
1206 if (strpos($address,
'<') ===
false) {
1208 if (static::validateAddress($address)) {
1211 'address' => $address,
1217 if (static::validateAddress(
$email)) {
1219 'name' => trim(str_replace([
'"',
"'"],
'',
$name)),
1243 $address = trim($address);
1244 $name = trim(preg_replace(
'/[\r\n]+/',
'',
$name));
1246 $pos = strrpos($address,
'@');
1247 if ((
false === $pos)
1248 || ((!$this->
has8bitChars(substr($address, ++$pos)) || !static::idnSupported())
1249 && !static::validateAddress($address))
1251 $error_message = sprintf(
1253 $this->
lang(
'invalid_address'),
1257 $this->
edebug($error_message);
1258 if ($this->exceptions) {
1264 $this->From = $address;
1265 $this->FromName =
$name;
1266 if ($auto && empty($this->Sender)) {
1267 $this->Sender = $address;
1312 if (null === $patternselect) {
1313 $patternselect = static::$validator;
1315 if (is_callable($patternselect)) {
1316 return $patternselect($address);
1319 if (strpos($address,
"\n") !==
false || strpos($address,
"\r") !==
false) {
1322 switch ($patternselect) {
1341 return (
bool) preg_match(
1342 '/^(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){255,})(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){65,}@)' .
1343 '((?>(?>(?>((?>(?>(?>\x0D\x0A)?[\t ])+|(?>[\t ]*\x0D\x0A)?[\t ]+)?)(\((?>(?2)' .
1344 '(?>[\x01-\x08\x0B\x0C\x0E-\'*-\[\]-\x7F]|\\\[\x00-\x7F]|(?3)))*(?2)\)))+(?2))|(?2))?)' .
1345 '([!#-\'*+\/-9=?^-~-]+|"(?>(?2)(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\x7F]))*' .
1346 '(?2)")(?>(?1)\.(?1)(?4))*(?1)@(?!(?1)[a-z0-9-]{64,})(?1)(?>([a-z0-9](?>[a-z0-9-]*[a-z0-9])?)' .
1347 '(?>(?1)\.(?!(?1)[a-z0-9-]{64,})(?1)(?5)){0,126}|\[(?:(?>IPv6:(?>([a-f0-9]{1,4})(?>:(?6)){7}' .
1348 '|(?!(?:.*[a-f0-9][:\]]){8,})((?6)(?>:(?6)){0,6})?::(?7)?))|(?>(?>IPv6:(?>(?6)(?>:(?6)){5}:' .
1349 '|(?!(?:.*[a-f0-9]:){6,})(?8)?::(?>((?6)(?>:(?6)){0,4}):)?))?(25[0-5]|2[0-4][0-9]|1[0-9]{2}' .
1350 '|[1-9]?[0-9])(?>\.(?9)){3}))\])(?1)$/isD',
1359 return (
bool) preg_match(
1360 '/^[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}' .
1361 '[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/sD',
1366 return filter_var($address, FILTER_VALIDATE_EMAIL) !==
false;
1378 return function_exists(
'idn_to_ascii') && function_exists(
'mb_convert_encoding');
1398 $pos = strrpos($address,
'@');
1399 if (!empty($this->CharSet) &&
1401 static::idnSupported()
1403 $domain = substr($address, ++$pos);
1409 if (defined(
'INTL_IDNA_VARIANT_UTS46')) {
1410 $punycode = idn_to_ascii(
$domain, $errorcode, INTL_IDNA_VARIANT_UTS46);
1411 } elseif (defined(
'INTL_IDNA_VARIANT_2003')) {
1412 $punycode = idn_to_ascii(
$domain, $errorcode, INTL_IDNA_VARIANT_2003);
1414 $punycode = idn_to_ascii(
$domain, $errorcode);
1416 if (
false !== $punycode) {
1417 return substr($address, 0, $pos) . $punycode;
1442 $this->mailHeader =
'';
1443 $this->
setError($exc->getMessage());
1444 if ($this->exceptions) {
1461 if (
'smtp' === $this->Mailer
1462 || (
'mail' === $this->Mailer && stripos(PHP_OS,
'WIN') === 0)
1466 static::setLE(self::CRLF);
1472 if (
'mail' === $this->Mailer
1473 && ((PHP_VERSION_ID >= 70000 && PHP_VERSION_ID < 70017)
1474 || (PHP_VERSION_ID >= 70100 && PHP_VERSION_ID < 70103))
1475 && ini_get(
'mail.add_x_header') ===
'1' 1476 && stripos(PHP_OS,
'WIN') === 0
1479 'Your version of PHP is affected by a bug that may result in corrupted messages.' .
1480 ' To fix it, switch to sending using SMTP, disable the mail.add_x_header option in' .
1481 ' your php.ini, switch to MacOS or Linux, or upgrade your PHP to version 7.0.17+ or 7.1.3+.',
1487 $this->error_count = 0;
1488 $this->mailHeader =
'';
1491 foreach (array_merge($this->RecipientsQueue, $this->ReplyToQueue) as
$params) {
1493 call_user_func_array([$this,
'addAnAddress'], $params);
1495 if (count($this->to) + count($this->cc) + count($this->bcc) < 1) {
1496 throw new Exception($this->
lang(
'provide_address'), self::STOP_CRITICAL);
1500 foreach ([
'From',
'Sender',
'ConfirmReadingTo'] as $address_kind) {
1501 $this->$address_kind = trim($this->$address_kind);
1502 if (empty($this->$address_kind)) {
1506 if (!static::validateAddress($this->$address_kind)) {
1507 $error_message = sprintf(
1509 $this->
lang(
'invalid_address'),
1511 $this->$address_kind
1514 $this->
edebug($error_message);
1515 if ($this->exceptions) {
1525 $this->ContentType = static::CONTENT_TYPE_MULTIPART_ALTERNATIVE;
1530 if (!$this->AllowEmpty && empty($this->Body)) {
1531 throw new Exception($this->
lang(
'empty_message'), self::STOP_CRITICAL);
1535 $this->Subject = trim($this->Subject);
1537 $this->MIMEHeader =
'';
1542 $this->MIMEHeader .= $tempheaders;
1546 if (
'mail' === $this->Mailer) {
1547 if (count($this->to) > 0) {
1548 $this->mailHeader .= $this->
addrAppend(
'To', $this->to);
1550 $this->mailHeader .= $this->
headerLine(
'To',
'undisclosed-recipients:;');
1559 if (!empty($this->DKIM_domain)
1560 && !empty($this->DKIM_selector)
1561 && (!empty($this->DKIM_private_string)
1562 || (!empty($this->DKIM_private)
1563 && static::isPermittedPath($this->DKIM_private)
1564 && file_exists($this->DKIM_private)
1569 $this->MIMEHeader . $this->mailHeader,
1573 $this->MIMEHeader = static::stripTrailingWSP($this->MIMEHeader) . static::$LE .
1574 static::normalizeBreaks($header_dkim) . static::$LE;
1579 $this->
setError($exc->getMessage());
1580 if ($this->exceptions) {
1599 switch ($this->Mailer) {
1602 return $this->
sendmailSend($this->MIMEHeader, $this->MIMEBody);
1604 return $this->
smtpSend($this->MIMEHeader, $this->MIMEBody);
1606 return $this->
mailSend($this->MIMEHeader, $this->MIMEBody);
1608 $sendMethod = $this->Mailer .
'Send';
1609 if (method_exists($this, $sendMethod)) {
1610 return $this->$sendMethod($this->MIMEHeader, $this->MIMEBody);
1613 return $this->
mailSend($this->MIMEHeader, $this->MIMEBody);
1616 $this->
setError($exc->getMessage());
1617 $this->
edebug($exc->getMessage());
1618 if ($this->exceptions) {
1640 $header = static::stripTrailingWSP(
$header) . static::$LE . static::$LE;
1643 if (!empty($this->Sender) && self::isShellSafe($this->Sender)) {
1644 if (
'qmail' === $this->Mailer) {
1645 $sendmailFmt =
'%s -f%s';
1647 $sendmailFmt =
'%s -oi -f%s -t';
1649 } elseif (
'qmail' === $this->Mailer) {
1650 $sendmailFmt =
'%s';
1652 $sendmailFmt =
'%s -oi -t';
1655 $sendmail = sprintf($sendmailFmt, escapeshellcmd($this->Sendmail), $this->Sender);
1657 if ($this->SingleTo) {
1658 foreach ($this->SingleToArray as $toAddr) {
1659 $mail = @popen($sendmail,
'w');
1661 throw new Exception($this->
lang(
'execute') . $this->Sendmail, self::STOP_CRITICAL);
1663 fwrite($mail,
'To: ' . $toAddr .
"\n");
1665 fwrite($mail, $body);
1678 throw new Exception($this->
lang(
'execute') . $this->Sendmail, self::STOP_CRITICAL);
1682 $mail = @popen($sendmail,
'w');
1684 throw new Exception($this->
lang(
'execute') . $this->Sendmail, self::STOP_CRITICAL);
1687 fwrite($mail, $body);
1700 throw new Exception($this->
lang(
'execute') . $this->Sendmail, self::STOP_CRITICAL);
1720 if (escapeshellcmd($string) !== $string
1721 || !in_array(escapeshellarg($string), [
"'$string'",
"\"$string\""])
1726 $length = strlen($string);
1728 for (
$i = 0;
$i < $length; ++
$i) {
1734 if (!ctype_alnum(
$c) && strpos(
'@_-.',
$c) ===
false) {
1753 return !preg_match(
'#^[a-z]+://#i',
$path);
1770 $header = static::stripTrailingWSP(
$header) . static::$LE . static::$LE;
1773 foreach ($this->to as $toaddr) {
1776 $to = implode(
', ', $toArr);
1787 if (!empty($this->Sender) && static::validateAddress($this->Sender) && self::isShellSafe($this->Sender)) {
1788 $params = sprintf(
'-f%s', $this->Sender);
1790 if (!empty($this->Sender) && static::validateAddress($this->Sender)) {
1791 $old_from = ini_get(
'sendmail_from');
1792 ini_set(
'sendmail_from', $this->Sender);
1795 if ($this->SingleTo && count($toArr) > 1) {
1796 foreach ($toArr as $toAddr) {
1798 $this->
doCallback(
$result, [$toAddr], $this->cc, $this->bcc, $this->Subject, $body, $this->From, []);
1802 $this->
doCallback(
$result, $this->to, $this->cc, $this->bcc, $this->Subject, $body, $this->From, []);
1804 if (isset($old_from)) {
1805 ini_set(
'sendmail_from', $old_from);
1808 throw new Exception($this->
lang(
'instantiate'), self::STOP_CRITICAL);
1823 if (!is_object($this->smtp)) {
1824 $this->smtp =
new SMTP();
1837 $this->smtp =
$smtp;
1859 $header = static::stripTrailingWSP(
$header) . static::$LE . static::$LE;
1862 throw new Exception($this->
lang(
'smtp_connect_failed'), self::STOP_CRITICAL);
1865 if (
'' === $this->Sender) {
1870 if (!$this->smtp->mail($smtp_from)) {
1871 $this->
setError($this->
lang(
'from_failed') . $smtp_from .
' : ' . implode(
',', $this->smtp->getError()));
1872 throw new Exception($this->ErrorInfo, self::STOP_CRITICAL);
1877 foreach ([$this->to, $this->cc, $this->bcc] as $togroup) {
1878 foreach ($togroup as
$to) {
1879 if (!$this->smtp->recipient($to[0], $this->dsn)) {
1880 $error = $this->smtp->getError();
1881 $bad_rcpt[] = [
'to' => $to[0],
'error' => $error[
'detail']];
1887 $callbacks[] = [
'issent'=>$isSent,
'to'=>$to[0]];
1892 if ((count($this->all_recipients) > count($bad_rcpt)) && !$this->smtp->data(
$header . $body)) {
1893 throw new Exception($this->
lang(
'data_not_accepted'), self::STOP_CRITICAL);
1896 $smtp_transaction_id = $this->smtp->getLastTransactionID();
1898 if ($this->SMTPKeepAlive) {
1899 $this->smtp->reset();
1901 $this->smtp->quit();
1902 $this->smtp->close();
1905 foreach ($callbacks as $cb) {
1914 [
'smtp_transaction_id' => $smtp_transaction_id]
1919 if (count($bad_rcpt) > 0) {
1921 foreach ($bad_rcpt as $bad) {
1922 $errstr .= $bad[
'to'] .
': ' . $bad[
'error'];
1924 throw new Exception($this->
lang(
'recipients_failed') . $errstr, self::STOP_CONTINUE);
1944 if (null === $this->smtp) {
1954 if ($this->smtp->connected()) {
1958 $this->smtp->setTimeout($this->Timeout);
1959 $this->smtp->setDebugLevel($this->SMTPDebug);
1960 $this->smtp->setDebugOutput($this->Debugoutput);
1961 $this->smtp->setVerp($this->do_verp);
1962 $hosts = explode(
';', $this->Host);
1963 $lastexception = null;
1965 foreach ($hosts as $hostentry) {
1968 '/^(?:(ssl|tls):\/\/)?(.+?)(?::(\d+))?$/',
1972 $this->
edebug($this->
lang(
'invalid_hostentry') .
' ' . trim($hostentry));
1983 if (!static::isValidHost($hostinfo[2])) {
1984 $this->
edebug($this->
lang(
'invalid_host') .
' ' . $hostinfo[2]);
1990 if (
'ssl' === $hostinfo[1] || (
'' === $hostinfo[1] && static::ENCRYPTION_SMTPS === $this->SMTPSecure)) {
1993 $secure = static::ENCRYPTION_SMTPS;
1994 } elseif (
'tls' === $hostinfo[1]) {
1997 $secure = static::ENCRYPTION_STARTTLS;
2000 $sslext = defined(
'OPENSSL_ALGO_SHA256');
2001 if (static::ENCRYPTION_STARTTLS === $secure || static::ENCRYPTION_SMTPS === $secure) {
2004 throw new Exception($this->
lang(
'extension_missing') .
'openssl', self::STOP_CRITICAL);
2007 $host = $hostinfo[2];
2009 if (array_key_exists(3, $hostinfo) && is_numeric($hostinfo[3]) && $hostinfo[3] > 0 && $hostinfo[3] < 65536) {
2010 $port = (int) $hostinfo[3];
2012 if ($this->smtp->connect($prefix . $host, $port, $this->Timeout,
$options)) {
2019 $this->smtp->hello($hello);
2025 if ($this->SMTPAutoTLS && $sslext &&
'ssl' !== $secure && $this->smtp->getServerExt(
'STARTTLS')) {
2029 if (!$this->smtp->startTLS()) {
2033 $this->smtp->hello($hello);
2035 if ($this->SMTPAuth && !$this->smtp->authenticate(
2046 $lastexception = $exc;
2047 $this->
edebug($exc->getMessage());
2049 $this->smtp->quit();
2054 $this->smtp->close();
2056 if ($this->exceptions && null !== $lastexception) {
2057 throw $lastexception;
2068 if ((null !== $this->smtp) && $this->smtp->connected()) {
2069 $this->smtp->quit();
2070 $this->smtp->close();
2087 $renamed_langcodes = [
2098 if (isset($renamed_langcodes[$langcode])) {
2099 $langcode = $renamed_langcodes[$langcode];
2104 'authenticate' =>
'SMTP Error: Could not authenticate.',
2105 'connect_host' =>
'SMTP Error: Could not connect to SMTP host.',
2106 'data_not_accepted' =>
'SMTP Error: data not accepted.',
2107 'empty_message' =>
'Message body empty',
2108 'encoding' =>
'Unknown encoding: ',
2109 'execute' =>
'Could not execute: ',
2110 'file_access' =>
'Could not access file: ',
2111 'file_open' =>
'File Error: Could not open file: ',
2112 'from_failed' =>
'The following From address failed: ',
2113 'instantiate' =>
'Could not instantiate mail function.',
2114 'invalid_address' =>
'Invalid address: ',
2115 'invalid_hostentry' =>
'Invalid hostentry: ',
2116 'invalid_host' =>
'Invalid host: ',
2117 'mailer_not_supported' =>
' mailer is not supported.',
2118 'provide_address' =>
'You must provide at least one recipient email address.',
2119 'recipients_failed' =>
'SMTP Error: The following recipients failed: ',
2120 'signing' =>
'Signing Error: ',
2121 'smtp_connect_failed' =>
'SMTP connect() failed.',
2122 'smtp_error' =>
'SMTP server error: ',
2123 'variable_set' =>
'Cannot set or reset variable: ',
2124 'extension_missing' =>
'Extension missing: ',
2126 if (empty($lang_path)) {
2128 $lang_path = dirname(__DIR__) . DIRECTORY_SEPARATOR .
'language' . DIRECTORY_SEPARATOR;
2131 if (!preg_match(
'/^[a-z]{2}(?:_[a-zA-Z]{2})?$/', $langcode)) {
2135 $lang_file = $lang_path .
'phpmailer.lang-' . $langcode .
'.php';
2137 if (
'en' !== $langcode) {
2139 if (!static::isPermittedPath($lang_file) || !file_exists($lang_file)) {
2144 $foundlang = include $lang_file;
2149 return (
bool) $foundlang;
2176 foreach ($addr as $address) {
2180 return $type .
': ' . implode(
', ', $addresses) . static::$LE;
2193 if (empty($addr[1])) {
2216 $soft_break = sprintf(
' =%s', static::$LE);
2218 $soft_break = static::$LE;
2222 $is_utf8 = static::CHARSET_UTF8 === strtolower($this->CharSet);
2223 $lelen = strlen(static::$LE);
2224 $crlflen = strlen(static::$LE);
2228 if (substr(
$message, -$lelen) === static::$LE) {
2233 $lines = explode(static::$LE,
$message);
2236 foreach ($lines as $line) {
2237 $words = explode(
' ', $line);
2240 foreach ($words as $word) {
2241 if ($qp_mode && (strlen($word) > $length)) {
2242 $space_left = $length - strlen($buf) - $crlflen;
2244 if ($space_left > 20) {
2248 } elseif (
'=' === substr($word, $len - 1, 1)) {
2250 } elseif (
'=' === substr($word, $len - 2, 1)) {
2253 $part = substr($word, 0, $len);
2254 $word = substr($word, $len);
2255 $buf .=
' ' . $part;
2256 $message .= $buf . sprintf(
'=%s', static::$LE);
2262 while ($word !==
'') {
2269 } elseif (
'=' === substr($word, $len - 1, 1)) {
2271 } elseif (
'=' === substr($word, $len - 2, 1)) {
2274 $part = substr($word, 0, $len);
2275 $word = (string) substr($word, $len);
2278 $message .= $part . sprintf(
'=%s', static::$LE);
2290 if (
'' !== $buf_o && strlen($buf) > $length) {
2315 $foundSplitPos =
false;
2317 while (!$foundSplitPos) {
2318 $lastChunk = substr($encodedText, $maxLength - $lookBack, $lookBack);
2319 $encodedCharPos = strpos($lastChunk,
'=');
2320 if (
false !== $encodedCharPos) {
2323 $hex = substr($encodedText, $maxLength - $lookBack + $encodedCharPos + 1, 2);
2324 $dec = hexdec($hex);
2329 if ($encodedCharPos > 0) {
2330 $maxLength -= $lookBack - $encodedCharPos;
2332 $foundSplitPos =
true;
2333 } elseif ($dec >= 192) {
2336 $maxLength -= $lookBack - $encodedCharPos;
2337 $foundSplitPos =
true;
2338 } elseif ($dec < 192) {
2344 $foundSplitPos =
true;
2359 if ($this->WordWrap < 1) {
2363 switch ($this->message_type) {
2367 case 'alt_inline_attach':
2368 $this->AltBody = $this->
wrapText($this->AltBody, $this->WordWrap);
2371 $this->Body = $this->
wrapText($this->Body, $this->WordWrap);
2385 $result .= $this->
headerLine(
'Date',
'' === $this->MessageDate ? self::rfcDate() : $this->MessageDate);
2388 if ($this->SingleTo) {
2389 if (
'mail' !== $this->Mailer) {
2390 foreach ($this->to as $toaddr) {
2391 $this->SingleToArray[] = $this->
addrFormat($toaddr);
2394 } elseif (count($this->to) > 0) {
2395 if (
'mail' !== $this->Mailer) {
2398 } elseif (count($this->cc) === 0) {
2405 if (count($this->cc) > 0) {
2411 'sendmail' === $this->Mailer ||
'qmail' === $this->Mailer ||
'mail' === $this->Mailer
2413 && count($this->bcc) > 0
2418 if (count($this->ReplyTo) > 0) {
2423 if (
'mail' !== $this->Mailer) {
2429 if (
'' !== $this->MessageID && preg_match(
'/^<.*@.*>$/', $this->MessageID)) {
2432 $this->lastMessageID = sprintf(
'<%s@%s>', $this->uniqueid, $this->
serverHostname());
2435 if (null !== $this->Priority) {
2438 if (
'' === $this->XMailer) {
2441 'PHPMailer ' . self::VERSION .
' (https://github.com/PHPMailer/PHPMailer)' 2444 $myXmailer = trim($this->XMailer);
2450 if (
'' !== $this->ConfirmReadingTo) {
2451 $result .= $this->
headerLine(
'Disposition-Notification-To',
'<' . $this->ConfirmReadingTo .
'>');
2455 foreach ($this->CustomHeader as
$header) {
2461 if (!$this->sign_key_file) {
2477 $ismultipart =
true;
2478 switch ($this->message_type) {
2480 $result .= $this->
headerLine(
'Content-Type', static::CONTENT_TYPE_MULTIPART_RELATED .
';');
2484 case 'inline_attach':
2486 case 'alt_inline_attach':
2487 $result .= $this->
headerLine(
'Content-Type', static::CONTENT_TYPE_MULTIPART_MIXED .
';');
2492 $result .= $this->
headerLine(
'Content-Type', static::CONTENT_TYPE_MULTIPART_ALTERNATIVE .
';');
2497 $result .= $this->
textLine(
'Content-Type: ' . $this->ContentType .
'; charset=' . $this->CharSet);
2498 $ismultipart =
false;
2502 if (static::ENCODING_7BIT !== $this->Encoding) {
2505 if (static::ENCODING_8BIT === $this->Encoding) {
2506 $result .= $this->
headerLine(
'Content-Transfer-Encoding', static::ENCODING_8BIT);
2514 if (
'mail' !== $this->Mailer) {
2532 return static::stripTrailingWSP($this->MIMEHeader . $this->mailHeader) .
2545 if (function_exists(
'random_bytes')) {
2547 $bytes = random_bytes($len);
2551 } elseif (function_exists(
'openssl_random_pseudo_bytes')) {
2553 $bytes = openssl_random_pseudo_bytes($len);
2555 if ($bytes ===
'') {
2558 $bytes =
hash(
'sha256', uniqid((
string) mt_rand(),
true),
true);
2562 return str_replace([
'=',
'+',
'/'],
'', base64_encode(
hash(
'sha256', $bytes,
true)));
2582 if ($this->sign_key_file) {
2591 if (static::ENCODING_8BIT === $bodyEncoding && !$this->
has8bitChars($this->Body)) {
2592 $bodyEncoding = static::ENCODING_7BIT;
2594 $bodyCharSet = static::CHARSET_ASCII;
2598 if (static::ENCODING_BASE64 !== $this->Encoding && static::hasLineLongerThanMax($this->Body)) {
2599 $bodyEncoding = static::ENCODING_QUOTED_PRINTABLE;
2605 if (static::ENCODING_8BIT === $altBodyEncoding && !$this->
has8bitChars($this->AltBody)) {
2606 $altBodyEncoding = static::ENCODING_7BIT;
2608 $altBodyCharSet = static::CHARSET_ASCII;
2612 if (static::ENCODING_BASE64 !== $altBodyEncoding && static::hasLineLongerThanMax($this->AltBody)) {
2613 $altBodyEncoding = static::ENCODING_QUOTED_PRINTABLE;
2616 $mimepre =
'This is a multi-part message in MIME format.' . static::$LE . static::$LE;
2617 switch ($this->message_type) {
2620 $body .= $this->
getBoundary($this->boundary[1], $bodyCharSet,
'', $bodyEncoding);
2621 $body .= $this->
encodeString($this->Body, $bodyEncoding);
2622 $body .= static::$LE;
2623 $body .= $this->
attachAll(
'inline', $this->boundary[1]);
2627 $body .= $this->
getBoundary($this->boundary[1], $bodyCharSet,
'', $bodyEncoding);
2628 $body .= $this->
encodeString($this->Body, $bodyEncoding);
2629 $body .= static::$LE;
2630 $body .= $this->
attachAll(
'attachment', $this->boundary[1]);
2632 case 'inline_attach':
2634 $body .= $this->
textLine(
'--' . $this->boundary[1]);
2635 $body .= $this->
headerLine(
'Content-Type', static::CONTENT_TYPE_MULTIPART_RELATED .
';');
2636 $body .= $this->
textLine(
' boundary="' . $this->boundary[2] .
'";');
2637 $body .= $this->
textLine(
' type="' . static::CONTENT_TYPE_TEXT_HTML .
'"');
2638 $body .= static::$LE;
2639 $body .= $this->
getBoundary($this->boundary[2], $bodyCharSet,
'', $bodyEncoding);
2640 $body .= $this->
encodeString($this->Body, $bodyEncoding);
2641 $body .= static::$LE;
2642 $body .= $this->
attachAll(
'inline', $this->boundary[2]);
2643 $body .= static::$LE;
2644 $body .= $this->
attachAll(
'attachment', $this->boundary[1]);
2651 static::CONTENT_TYPE_PLAINTEXT,
2654 $body .= $this->
encodeString($this->AltBody, $altBodyEncoding);
2655 $body .= static::$LE;
2659 static::CONTENT_TYPE_TEXT_HTML,
2662 $body .= $this->
encodeString($this->Body, $bodyEncoding);
2663 $body .= static::$LE;
2664 if (!empty($this->Ical)) {
2665 $method = static::ICAL_METHOD_REQUEST;
2666 foreach (static::$IcalMethods as $imethod) {
2667 if (stripos($this->Ical,
'METHOD:' . $imethod) !==
false) {
2675 static::CONTENT_TYPE_TEXT_CALENDAR .
'; method=' . $method,
2678 $body .= $this->
encodeString($this->Ical, $this->Encoding);
2679 $body .= static::$LE;
2688 static::CONTENT_TYPE_PLAINTEXT,
2691 $body .= $this->
encodeString($this->AltBody, $altBodyEncoding);
2692 $body .= static::$LE;
2693 $body .= $this->
textLine(
'--' . $this->boundary[1]);
2694 $body .= $this->
headerLine(
'Content-Type', static::CONTENT_TYPE_MULTIPART_RELATED .
';');
2695 $body .= $this->
textLine(
' boundary="' . $this->boundary[2] .
'";');
2696 $body .= $this->
textLine(
' type="' . static::CONTENT_TYPE_TEXT_HTML .
'"');
2697 $body .= static::$LE;
2701 static::CONTENT_TYPE_TEXT_HTML,
2704 $body .= $this->
encodeString($this->Body, $bodyEncoding);
2705 $body .= static::$LE;
2706 $body .= $this->
attachAll(
'inline', $this->boundary[2]);
2707 $body .= static::$LE;
2712 $body .= $this->
textLine(
'--' . $this->boundary[1]);
2713 $body .= $this->
headerLine(
'Content-Type', static::CONTENT_TYPE_MULTIPART_ALTERNATIVE .
';');
2714 $body .= $this->
textLine(
' boundary="' . $this->boundary[2] .
'"');
2715 $body .= static::$LE;
2719 static::CONTENT_TYPE_PLAINTEXT,
2722 $body .= $this->
encodeString($this->AltBody, $altBodyEncoding);
2723 $body .= static::$LE;
2727 static::CONTENT_TYPE_TEXT_HTML,
2730 $body .= $this->
encodeString($this->Body, $bodyEncoding);
2731 $body .= static::$LE;
2732 if (!empty($this->Ical)) {
2733 $method = static::ICAL_METHOD_REQUEST;
2734 foreach (static::$IcalMethods as $imethod) {
2735 if (stripos($this->Ical,
'METHOD:' . $imethod) !==
false) {
2743 static::CONTENT_TYPE_TEXT_CALENDAR .
'; method=' . $method,
2746 $body .= $this->
encodeString($this->Ical, $this->Encoding);
2749 $body .= static::$LE;
2750 $body .= $this->
attachAll(
'attachment', $this->boundary[1]);
2752 case 'alt_inline_attach':
2754 $body .= $this->
textLine(
'--' . $this->boundary[1]);
2755 $body .= $this->
headerLine(
'Content-Type', static::CONTENT_TYPE_MULTIPART_ALTERNATIVE .
';');
2756 $body .= $this->
textLine(
' boundary="' . $this->boundary[2] .
'"');
2757 $body .= static::$LE;
2761 static::CONTENT_TYPE_PLAINTEXT,
2764 $body .= $this->
encodeString($this->AltBody, $altBodyEncoding);
2765 $body .= static::$LE;
2766 $body .= $this->
textLine(
'--' . $this->boundary[2]);
2767 $body .= $this->
headerLine(
'Content-Type', static::CONTENT_TYPE_MULTIPART_RELATED .
';');
2768 $body .= $this->
textLine(
' boundary="' . $this->boundary[3] .
'";');
2769 $body .= $this->
textLine(
' type="' . static::CONTENT_TYPE_TEXT_HTML .
'"');
2770 $body .= static::$LE;
2774 static::CONTENT_TYPE_TEXT_HTML,
2777 $body .= $this->
encodeString($this->Body, $bodyEncoding);
2778 $body .= static::$LE;
2779 $body .= $this->
attachAll(
'inline', $this->boundary[3]);
2780 $body .= static::$LE;
2782 $body .= static::$LE;
2783 $body .= $this->
attachAll(
'attachment', $this->boundary[1]);
2788 $this->Encoding = $bodyEncoding;
2789 $body .= $this->
encodeString($this->Body, $this->Encoding);
2795 if ($this->exceptions) {
2796 throw new Exception($this->
lang(
'empty_message'), self::STOP_CRITICAL);
2798 } elseif ($this->sign_key_file) {
2800 if (!defined(
'PKCS7_TEXT')) {
2801 throw new Exception($this->
lang(
'extension_missing') .
'openssl');
2804 $file = tempnam(sys_get_temp_dir(),
'srcsign');
2805 $signed = tempnam(sys_get_temp_dir(),
'mailsign');
2806 file_put_contents($file, $body);
2809 if (empty($this->sign_extracerts_file)) {
2810 $sign = @openssl_pkcs7_sign(
2813 'file://' . realpath($this->sign_cert_file),
2814 [
'file://' . realpath($this->sign_key_file), $this->sign_key_pass],
2818 $sign = @openssl_pkcs7_sign(
2821 'file://' . realpath($this->sign_cert_file),
2822 [
'file://' . realpath($this->sign_key_file), $this->sign_key_pass],
2825 $this->sign_extracerts_file
2831 $body = file_get_contents($signed);
2834 $parts = explode(
"\n\n", $body, 2);
2835 $this->MIMEHeader .= $parts[0] . static::$LE . static::$LE;
2839 throw new Exception($this->
lang(
'signing') . openssl_error_string());
2843 if ($this->exceptions) {
2865 if (
'' === $charSet) {
2871 if (
'' === $encoding) {
2878 if (static::ENCODING_7BIT !== $encoding) {
2895 return static::$LE .
'--' .
$boundary .
'--' . static::$LE;
2914 $this->message_type = implode(
'_',
$type);
2915 if (
'' === $this->message_type) {
2917 $this->message_type =
'plain';
2931 return $name .
': ' . $value . static::$LE;
2943 return $value . static::$LE;
2966 $encoding = self::ENCODING_BASE64,
2968 $disposition =
'attachment' 2971 if (!static::isPermittedPath(
$path) || !@is_file(
$path) || !is_readable(
$path)) {
2980 $filename = (string) static::mb_pathinfo(
$path, PATHINFO_BASENAME);
3000 $this->
setError($exc->getMessage());
3001 $this->
edebug($exc->getMessage());
3002 if ($this->exceptions) {
3043 if ($attachment[6] === $disposition_type) {
3047 $bString = $attachment[5];
3049 $string = $attachment[0];
3051 $path = $attachment[0];
3054 $inclhash =
hash(
'sha256', serialize($attachment));
3055 if (in_array($inclhash, $incl,
true)) {
3058 $incl[] = $inclhash;
3059 $name = $attachment[2];
3060 $encoding = $attachment[3];
3061 $type = $attachment[4];
3062 $disposition = $attachment[6];
3063 $cid = $attachment[7];
3064 if (
'inline' === $disposition && array_key_exists($cid, $cidUniq)) {
3067 $cidUniq[$cid] =
true;
3069 $mime[] = sprintf(
'--%s%s',
$boundary, static::$LE);
3071 if (!empty(
$name)) {
3073 'Content-Type: %s; name=%s%s',
3080 'Content-Type: %s%s',
3086 if (static::ENCODING_7BIT !== $encoding) {
3087 $mime[] = sprintf(
'Content-Transfer-Encoding: %s%s', $encoding, static::$LE);
3091 if ((
string) $cid !==
'' && $disposition ===
'inline') {
3096 if (!empty($disposition)) {
3098 if (!empty($encoded_name)) {
3100 'Content-Disposition: %s; filename=%s%s',
3102 static::quotedString($encoded_name),
3103 static::$LE . static::$LE
3107 'Content-Disposition: %s%s',
3109 static::$LE . static::$LE
3113 $mime[] = static::$LE;
3125 $mime[] = static::$LE;
3129 $mime[] = sprintf(
'--%s--%s',
$boundary, static::$LE);
3131 return implode(
'', $mime);
3146 if (!static::isPermittedPath(
$path) || !file_exists(
$path) || !is_readable(
$path)) {
3149 $file_buffer = file_get_contents(
$path);
3150 if (
false === $file_buffer) {
3153 $file_buffer = $this->
encodeString($file_buffer, $encoding);
3155 return $file_buffer;
3157 $this->
setError($exc->getMessage());
3158 $this->
edebug($exc->getMessage());
3159 if ($this->exceptions) {
3181 switch (strtolower($encoding)) {
3182 case static::ENCODING_BASE64:
3183 $encoded = chunk_split(
3184 base64_encode($str),
3185 static::STD_LINE_LENGTH,
3189 case static::ENCODING_7BIT:
3190 case static::ENCODING_8BIT:
3191 $encoded = static::normalizeBreaks($str);
3193 if (substr($encoded, -(strlen(static::$LE))) !== static::$LE) {
3194 $encoded .= static::$LE;
3197 case static::ENCODING_BINARY:
3200 case static::ENCODING_QUOTED_PRINTABLE:
3205 if ($this->exceptions) {
3227 switch (strtolower($position)) {
3229 if (!preg_match(
'/[\200-\377]/', $str)) {
3231 $encoded = addcslashes($str,
"\0..\37\177\\\"");
3232 if (($str === $encoded) && !preg_match(
'/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) {
3236 return "\"$encoded\"";
3238 $matchcount = preg_match_all(
'/[^\040\041\043-\133\135-\176]/', $str, $matches);
3242 $matchcount = preg_match_all(
'/[()"]/', $str, $matches);
3246 $matchcount += preg_match_all(
'/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches);
3253 $charset = static::CHARSET_ASCII;
3257 $overhead = 8 + strlen($charset);
3259 if (
'mail' === $this->Mailer) {
3260 $maxlen = static::MAIL_MAX_LINE_LENGTH - $overhead;
3262 $maxlen = static::MAX_LINE_LENGTH - $overhead;
3266 if ($matchcount > strlen($str) / 3) {
3269 } elseif ($matchcount > 0) {
3272 } elseif (strlen($str) > $maxlen) {
3280 switch ($encoding) {
3287 $encoded = base64_encode($str);
3288 $maxlen -= $maxlen % 4;
3289 $encoded = trim(chunk_split($encoded, $maxlen,
"\n"));
3291 $encoded = preg_replace(
'/^(.*)$/m',
' =?' . $charset .
"?$encoding?\\1?=", $encoded);
3294 $encoded = $this->
encodeQ($str, $position);
3295 $encoded = $this->
wrapText($encoded, $maxlen,
true);
3296 $encoded = str_replace(
'=' . static::$LE,
"\n", trim($encoded));
3297 $encoded = preg_replace(
'/^(.*)$/m',
' =?' . $charset .
"?$encoding?\\1?=", $encoded);
3303 return trim(static::normalizeBreaks($encoded));
3315 if (function_exists(
'mb_strlen')) {
3316 return strlen($str) > mb_strlen($str, $this->CharSet);
3332 return (
bool) preg_match(
'/[\x80-\xFF]/',
$text);
3349 $start =
'=?' . $this->CharSet .
'?B?';
3352 if (null === $linebreak) {
3353 $linebreak = static::$LE;
3356 $mb_length = mb_strlen($str, $this->CharSet);
3358 $length = 75 - strlen(
$start) - strlen(
$end);
3360 $ratio = $mb_length / strlen($str);
3362 $avgLength = floor($length * $ratio * .75);
3365 for (
$i = 0;
$i < $mb_length;
$i += $offset) {
3368 $offset = $avgLength - $lookBack;
3369 $chunk = mb_substr($str,
$i, $offset, $this->CharSet);
3370 $chunk = base64_encode($chunk);
3372 }
while (strlen($chunk) > $length);
3373 $encoded .= $chunk . $linebreak;
3377 return substr($encoded, 0, -strlen($linebreak));
3390 return static::normalizeBreaks(quoted_printable_encode($string));
3407 $encoded = str_replace([
"\r",
"\n"],
'', $str);
3408 switch (strtolower($position)) {
3411 $pattern =
'^A-Za-z0-9!*+\/ -';
3425 $pattern =
'\000-\011\013\014\016-\037\075\077\137\177-\377' . $pattern;
3429 if (preg_match_all(
"/[{$pattern}]/", $encoded, $matches)) {
3432 $eqkey = array_search(
'=', $matches[0],
true);
3433 if (
false !== $eqkey) {
3434 unset($matches[0][$eqkey]);
3435 array_unshift($matches[0],
'=');
3437 foreach (array_unique($matches[0]) as $char) {
3438 $encoded = str_replace($char,
'=' . sprintf(
'%02X', ord($char)), $encoded);
3443 return str_replace(
' ',
'_', $encoded);
3464 $encoding = self::ENCODING_BASE64,
3466 $disposition =
'attachment' 3482 2 => static::mb_pathinfo(
$filename, PATHINFO_BASENAME),
3490 $this->
setError($exc->getMessage());
3491 $this->
edebug($exc->getMessage());
3492 if ($this->exceptions) {
3527 $encoding = self::ENCODING_BASE64,
3529 $disposition =
'inline' 3532 if (!static::isPermittedPath(
$path) || !@is_file(
$path) || !is_readable(
$path)) {
3545 $filename = (string) static::mb_pathinfo(
$path, PATHINFO_BASENAME);
3562 $this->
setError($exc->getMessage());
3563 $this->
edebug($exc->getMessage());
3564 if ($this->exceptions) {
3597 $encoding = self::ENCODING_BASE64,
3599 $disposition =
'inline' 3623 $this->
setError($exc->getMessage());
3624 $this->
edebug($exc->getMessage());
3625 if ($this->exceptions) {
3647 self::ENCODING_7BIT,
3648 self::ENCODING_QUOTED_PRINTABLE,
3649 self::ENCODING_BASE64,
3650 self::ENCODING_8BIT,
3651 self::ENCODING_BINARY,
3667 if (
'inline' === $attachment[6] && $cid === $attachment[7]) {
3683 if (
'inline' === $attachment[6]) {
3699 if (
'attachment' === $attachment[6]) {
3714 return !empty($this->AltBody);
3724 $this->RecipientsQueue = array_filter(
3725 $this->RecipientsQueue,
3726 static function (
$params) use ($kind) {
3737 foreach ($this->to as
$to) {
3738 unset($this->all_recipients[strtolower($to[0])]);
3749 foreach ($this->cc as
$cc) {
3750 unset($this->all_recipients[strtolower($cc[0])]);
3761 foreach ($this->bcc as
$bcc) {
3762 unset($this->all_recipients[strtolower($bcc[0])]);
3773 $this->ReplyTo = [];
3774 $this->ReplyToQueue = [];
3785 $this->all_recipients = [];
3786 $this->RecipientsQueue = [];
3802 $this->CustomHeader = [];
3813 if (
'smtp' === $this->Mailer && null !== $this->smtp) {
3814 $lasterror = $this->smtp->getError();
3815 if (!empty($lasterror[
'error'])) {
3816 $msg .= $this->
lang(
'smtp_error') . $lasterror[
'error'];
3817 if (!empty($lasterror[
'detail'])) {
3818 $msg .=
' Detail: ' . $lasterror[
'detail'];
3820 if (!empty($lasterror[
'smtp_code'])) {
3821 $msg .=
' SMTP code: ' . $lasterror[
'smtp_code'];
3823 if (!empty($lasterror[
'smtp_code_ex'])) {
3824 $msg .=
' Additional SMTP info: ' . $lasterror[
'smtp_code_ex'];
3828 $this->ErrorInfo = $msg;
3840 date_default_timezone_set(@date_default_timezone_get());
3842 return date(
'D, j M Y H:i:s O');
3854 if (!empty($this->Hostname)) {
3858 } elseif (function_exists(
'gethostname') && gethostname() !==
false) {
3860 } elseif (php_uname(
'n') !==
false) {
3863 if (!static::isValidHost(
$result)) {
3864 return 'localhost.localdomain';
3882 || !is_string($host)
3883 || strlen($host) > 256
3884 || !preg_match(
'/^([a-zA-Z\d.-]*|\[[a-fA-F\d:]+])$/', $host)
3889 if (strlen($host) > 2 && substr($host, 0, 1) ===
'[' && substr($host, -1, 1) ===
']') {
3890 return filter_var(substr($host, 1, -1), FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) !==
false;
3894 if (is_numeric(str_replace(
'.',
'', $host))) {
3896 return filter_var($host, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) !==
false;
3898 if (filter_var(
'http://' . $host, FILTER_VALIDATE_URL) !==
false) {
3920 if (
'smtp_connect_failed' ===
$key) {
3924 return $this->
language[
$key] .
' https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting';
3941 return $this->error_count > 0;
3956 if (null === $value && strpos(
$name,
':') !==
false) {
3958 list(
$name, $value) = explode(
':',
$name, 2);
3961 $value = trim($value);
3963 if (empty(
$name) || strpbrk(
$name . $value,
"\r\n") !==
false) {
3964 if ($this->exceptions) {
3965 throw new Exception(
'Invalid header name or value');
3970 $this->CustomHeader[] = [
$name, $value];
4007 preg_match_all(
'/(?<!-)(src|background)=["\'](.*)["\']/Ui',
$message, $images);
4008 if (array_key_exists(2, $images)) {
4009 if (strlen($basedir) > 1 &&
'/' !== substr($basedir, -1)) {
4013 foreach ($images[2] as $imgindex =>
$url) {
4017 if (preg_match(
'#^data:(image/(?:jpe?g|gif|png));?(base64)?,(.+)#',
$url, $match)) {
4018 if (count($match) === 4 && static::ENCODING_BASE64 === $match[2]) {
4019 $data = base64_decode($match[3]);
4020 } elseif (
'' === $match[2]) {
4021 $data = rawurldecode($match[3]);
4028 $cid = substr(
hash(
'sha256',
$data), 0, 32) .
'@phpmailer.0';
4034 'embed' . $imgindex,
4035 static::ENCODING_BASE64,
4040 $images[0][$imgindex],
4041 $images[1][$imgindex] .
'="cid:' . $cid .
'"',
4049 && (strpos(
$url,
'..') ===
false)
4051 && 0 !== strpos(
$url,
'cid:')
4053 && !preg_match(
'#^[a-z][a-z0-9+.-]*:?//#i',
$url)
4056 $directory = dirname(
$url);
4057 if (
'.' === $directory) {
4061 $cid = substr(
hash(
'sha256',
$url), 0, 32) .
'@phpmailer.0';
4062 if (strlen($basedir) > 1 &&
'/' !== substr($basedir, -1)) {
4065 if (strlen($directory) > 1 &&
'/' !== substr($directory, -1)) {
4072 static::ENCODING_BASE64,
4073 static::_mime_types((
string) static::mb_pathinfo($filename, PATHINFO_EXTENSION))
4077 '/' . $images[1][$imgindex] .
'=["\']' . preg_quote(
$url,
'/') .
'["\']/Ui',
4078 $images[1][$imgindex] .
'="cid:' . $cid .
'"',
4087 $this->Body = static::normalizeBreaks(
$message);
4088 $this->AltBody = static::normalizeBreaks($this->
html2text(
$message, $advanced));
4090 $this->AltBody =
'This is an HTML-only message. To view it, activate HTML in your email application.' 4122 if (is_callable($advanced)) {
4123 return $advanced(
$html);
4126 return html_entity_decode(
4127 trim(strip_tags(preg_replace(
'/<(head|title|style|script)[^>]*>.*?<\/\\1>/si',
'',
$html))),
4143 'xl' =>
'application/excel',
4144 'js' =>
'application/javascript',
4145 'hqx' =>
'application/mac-binhex40',
4146 'cpt' =>
'application/mac-compactpro',
4147 'bin' =>
'application/macbinary',
4148 'doc' =>
'application/msword',
4149 'word' =>
'application/msword',
4150 'xlsx' =>
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
4151 'xltx' =>
'application/vnd.openxmlformats-officedocument.spreadsheetml.template',
4152 'potx' =>
'application/vnd.openxmlformats-officedocument.presentationml.template',
4153 'ppsx' =>
'application/vnd.openxmlformats-officedocument.presentationml.slideshow',
4154 'pptx' =>
'application/vnd.openxmlformats-officedocument.presentationml.presentation',
4155 'sldx' =>
'application/vnd.openxmlformats-officedocument.presentationml.slide',
4156 'docx' =>
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
4157 'dotx' =>
'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
4158 'xlam' =>
'application/vnd.ms-excel.addin.macroEnabled.12',
4159 'xlsb' =>
'application/vnd.ms-excel.sheet.binary.macroEnabled.12',
4160 'class' =>
'application/octet-stream',
4161 'dll' =>
'application/octet-stream',
4162 'dms' =>
'application/octet-stream',
4163 'exe' =>
'application/octet-stream',
4164 'lha' =>
'application/octet-stream',
4165 'lzh' =>
'application/octet-stream',
4166 'psd' =>
'application/octet-stream',
4167 'sea' =>
'application/octet-stream',
4168 'so' =>
'application/octet-stream',
4169 'oda' =>
'application/oda',
4170 'pdf' =>
'application/pdf',
4171 'ai' =>
'application/postscript',
4172 'eps' =>
'application/postscript',
4173 'ps' =>
'application/postscript',
4174 'smi' =>
'application/smil',
4175 'smil' =>
'application/smil',
4176 'mif' =>
'application/vnd.mif',
4177 'xls' =>
'application/vnd.ms-excel',
4178 'ppt' =>
'application/vnd.ms-powerpoint',
4179 'wbxml' =>
'application/vnd.wap.wbxml',
4180 'wmlc' =>
'application/vnd.wap.wmlc',
4181 'dcr' =>
'application/x-director',
4182 'dir' =>
'application/x-director',
4183 'dxr' =>
'application/x-director',
4184 'dvi' =>
'application/x-dvi',
4185 'gtar' =>
'application/x-gtar',
4186 'php3' =>
'application/x-httpd-php',
4187 'php4' =>
'application/x-httpd-php',
4188 'php' =>
'application/x-httpd-php',
4189 'phtml' =>
'application/x-httpd-php',
4190 'phps' =>
'application/x-httpd-php-source',
4191 'swf' =>
'application/x-shockwave-flash',
4192 'sit' =>
'application/x-stuffit',
4193 'tar' =>
'application/x-tar',
4194 'tgz' =>
'application/x-tar',
4195 'xht' =>
'application/xhtml+xml',
4196 'xhtml' =>
'application/xhtml+xml',
4197 'zip' =>
'application/zip',
4198 'mid' =>
'audio/midi',
4199 'midi' =>
'audio/midi',
4200 'mp2' =>
'audio/mpeg',
4201 'mp3' =>
'audio/mpeg',
4202 'm4a' =>
'audio/mp4',
4203 'mpga' =>
'audio/mpeg',
4204 'aif' =>
'audio/x-aiff',
4205 'aifc' =>
'audio/x-aiff',
4206 'aiff' =>
'audio/x-aiff',
4207 'ram' =>
'audio/x-pn-realaudio',
4208 'rm' =>
'audio/x-pn-realaudio',
4209 'rpm' =>
'audio/x-pn-realaudio-plugin',
4210 'ra' =>
'audio/x-realaudio',
4211 'wav' =>
'audio/x-wav',
4212 'mka' =>
'audio/x-matroska',
4213 'bmp' =>
'image/bmp',
4214 'gif' =>
'image/gif',
4215 'jpeg' =>
'image/jpeg',
4216 'jpe' =>
'image/jpeg',
4217 'jpg' =>
'image/jpeg',
4218 'png' =>
'image/png',
4219 'tiff' =>
'image/tiff',
4220 'tif' =>
'image/tiff',
4221 'webp' =>
'image/webp',
4222 'heif' =>
'image/heif',
4223 'heifs' =>
'image/heif-sequence',
4224 'heic' =>
'image/heic',
4225 'heics' =>
'image/heic-sequence',
4226 'eml' =>
'message/rfc822',
4227 'css' =>
'text/css',
4228 'html' =>
'text/html',
4229 'htm' =>
'text/html',
4230 'shtml' =>
'text/html',
4231 'log' =>
'text/plain',
4232 'text' =>
'text/plain',
4233 'txt' =>
'text/plain',
4234 'rtx' =>
'text/richtext',
4235 'rtf' =>
'text/rtf',
4236 'vcf' =>
'text/vcard',
4237 'vcard' =>
'text/vcard',
4238 'ics' =>
'text/calendar',
4239 'xml' =>
'text/xml',
4240 'xsl' =>
'text/xml',
4241 'wmv' =>
'video/x-ms-wmv',
4242 'mpeg' =>
'video/mpeg',
4243 'mpe' =>
'video/mpeg',
4244 'mpg' =>
'video/mpeg',
4245 'mp4' =>
'video/mp4',
4246 'm4v' =>
'video/mp4',
4247 'mov' =>
'video/quicktime',
4248 'qt' =>
'video/quicktime',
4249 'rv' =>
'video/vnd.rn-realvideo',
4250 'avi' =>
'video/x-msvideo',
4251 'movie' =>
'video/x-sgi-movie',
4252 'webm' =>
'video/webm',
4253 'mkv' =>
'video/x-matroska',
4255 $ext = strtolower($ext);
4256 if (array_key_exists($ext, $mimes)) {
4257 return $mimes[$ext];
4260 return 'application/octet-stream';
4275 if (
false !== $qpos) {
4278 $ext = static::mb_pathinfo(
$filename, PATHINFO_EXTENSION);
4280 return static::_mime_types($ext);
4297 $ret = [
'dirname' =>
'',
'basename' =>
'',
'extension' =>
'',
'filename' =>
''];
4299 if (preg_match(
'#^(.*?)[\\\\/]*(([^/\\\\]*?)(\.([^.\\\\/]+?)|))[\\\\/.]*$#m',
$path, $pathinfo)) {
4300 if (array_key_exists(1, $pathinfo)) {
4301 $ret[
'dirname'] = $pathinfo[1];
4303 if (array_key_exists(2, $pathinfo)) {
4304 $ret[
'basename'] = $pathinfo[2];
4306 if (array_key_exists(5, $pathinfo)) {
4307 $ret[
'extension'] = $pathinfo[5];
4309 if (array_key_exists(3, $pathinfo)) {
4310 $ret[
'filename'] = $pathinfo[3];
4314 case PATHINFO_DIRNAME:
4316 return $ret[
'dirname'];
4317 case PATHINFO_BASENAME:
4319 return $ret[
'basename'];
4320 case PATHINFO_EXTENSION:
4322 return $ret[
'extension'];
4323 case PATHINFO_FILENAME:
4325 return $ret[
'filename'];
4347 if (property_exists($this,
$name)) {
4348 $this->
$name = $value;
4366 return trim(str_replace([
"\r",
"\n"],
'', $str));
4381 if (null === $breaktype) {
4382 $breaktype = static::$LE;
4385 $text = str_replace([self::CRLF,
"\r"],
"\n",
$text);
4387 if (
"\n" !== $breaktype) {
4388 $text = str_replace(
"\n", $breaktype,
$text);
4403 return rtrim(
$text,
" \r\n\t");
4434 public function sign($cert_filename, $key_filename, $key_pass, $extracerts_filename =
'')
4436 $this->sign_cert_file = $cert_filename;
4437 $this->sign_key_file = $key_filename;
4438 $this->sign_key_pass = $key_pass;
4439 $this->sign_extracerts_file = $extracerts_filename;
4452 $len = strlen(
$txt);
4453 for (
$i = 0;
$i < $len; ++
$i) {
4455 if (((0x21 <= $ord) && ($ord <= 0x3A)) || $ord === 0x3C || ((0x3E <= $ord) && ($ord <= 0x7E))) {
4458 $line .=
'=' . sprintf(
'%02X', $ord);
4476 if (!defined(
'PKCS7_TEXT')) {
4477 if ($this->exceptions) {
4478 throw new Exception($this->
lang(
'extension_missing') .
'openssl');
4483 $privKeyStr = !empty($this->DKIM_private_string) ?
4484 $this->DKIM_private_string :
4485 file_get_contents($this->DKIM_private);
4486 if (
'' !== $this->DKIM_passphrase) {
4487 $privKey = openssl_pkey_get_private($privKeyStr, $this->DKIM_passphrase);
4489 $privKey = openssl_pkey_get_private($privKeyStr);
4491 if (openssl_sign($signHeader, $signature, $privKey,
'sha256WithRSAEncryption')) {
4492 openssl_pkey_free($privKey);
4494 return base64_encode($signature);
4496 openssl_pkey_free($privKey);
4515 $signHeader = static::normalizeBreaks($signHeader, self::CRLF);
4520 $signHeader = preg_replace(
'/\r\n[ \t]+/',
' ', $signHeader);
4522 $lines = explode(self::CRLF, $signHeader);
4523 foreach ($lines as
$key => $line) {
4527 if (strpos($line,
':') ===
false) {
4530 list($heading, $value) = explode(
':', $line, 2);
4532 $heading = strtolower($heading);
4534 $value = preg_replace(
'/[ \t]+/',
' ', $value);
4539 $lines[
$key] = trim($heading,
" \t") .
':' . trim($value,
" \t");
4542 return implode(self::CRLF, $lines);
4562 $body = static::normalizeBreaks($body, self::CRLF);
4565 return static::stripTrailingWSP($body) . self::CRLF;
4579 public function DKIM_Add($headers_line, $subject, $body)
4581 $DKIMsignatureType =
'rsa-sha256';
4582 $DKIMcanonicalization =
'relaxed/simple';
4583 $DKIMquery =
'dns/txt';
4587 $autoSignHeaders = [
4599 if (stripos($headers_line,
'Subject') ===
false) {
4600 $headers_line .=
'Subject: ' . $subject . static::$LE;
4602 $headerLines = explode(static::$LE, $headers_line);
4603 $currentHeaderLabel =
'';
4604 $currentHeaderValue =
'';
4605 $parsedHeaders = [];
4606 $headerLineIndex = 0;
4607 $headerLineCount = count($headerLines);
4608 foreach ($headerLines as $headerLine) {
4610 if (preg_match(
'/^([^ \t]*?)(?::[ \t]*)(.*)$/', $headerLine, $matches)) {
4611 if ($currentHeaderLabel !==
'') {
4613 $parsedHeaders[] = [
'label' => $currentHeaderLabel,
'value' => $currentHeaderValue];
4615 $currentHeaderLabel = $matches[1];
4616 $currentHeaderValue = $matches[2];
4617 } elseif (preg_match(
'/^[ \t]+(.*)$/', $headerLine, $matches)) {
4619 $currentHeaderValue .=
' ' . $matches[1];
4622 if ($headerLineIndex >= $headerLineCount) {
4624 $parsedHeaders[] = [
'label' => $currentHeaderLabel,
'value' => $currentHeaderValue];
4627 $copiedHeaders = [];
4628 $headersToSignKeys = [];
4629 $headersToSign = [];
4630 foreach ($parsedHeaders as
$header) {
4632 if (in_array(strtolower($header[
'label']), $autoSignHeaders,
true)) {
4633 $headersToSignKeys[] = $header[
'label'];
4634 $headersToSign[] = $header[
'label'] .
': ' . $header[
'value'];
4635 if ($this->DKIM_copyHeaderFields) {
4636 $copiedHeaders[] = $header[
'label'] .
':' .
4637 str_replace(
'|',
'=7C', $this->
DKIM_QP($header[
'value']));
4642 if (in_array($header[
'label'], $this->DKIM_extraHeaders,
true)) {
4644 foreach ($this->CustomHeader as $customHeader) {
4645 if ($customHeader[0] === $header[
'label']) {
4646 $headersToSignKeys[] = $header[
'label'];
4647 $headersToSign[] = $header[
'label'] .
': ' . $header[
'value'];
4648 if ($this->DKIM_copyHeaderFields) {
4649 $copiedHeaders[] = $header[
'label'] .
':' .
4650 str_replace(
'|',
'=7C', $this->
DKIM_QP($header[
'value']));
4658 $copiedHeaderFields =
'';
4659 if ($this->DKIM_copyHeaderFields && count($copiedHeaders) > 0) {
4661 $copiedHeaderFields =
' z=';
4663 foreach ($copiedHeaders as $copiedHeader) {
4665 $copiedHeaderFields .= static::$LE .
' |';
4668 if (strlen($copiedHeader) > self::STD_LINE_LENGTH - 3) {
4669 $copiedHeaderFields .= substr(
4670 chunk_split($copiedHeader, self::STD_LINE_LENGTH - 3, static::$LE . self::FWS),
4672 -strlen(static::$LE . self::FWS)
4675 $copiedHeaderFields .= $copiedHeader;
4679 $copiedHeaderFields .=
';' . static::$LE;
4681 $headerKeys =
' h=' . implode(
':', $headersToSignKeys) .
';' . static::$LE;
4682 $headerValues = implode(static::$LE, $headersToSign);
4684 $DKIMb64 = base64_encode(pack(
'H*',
hash(
'sha256', $body)));
4686 if (
'' !== $this->DKIM_identity) {
4687 $ident =
' i=' . $this->DKIM_identity .
';' . static::$LE;
4692 $dkimSignatureHeader =
'DKIM-Signature: v=1;' .
4693 ' d=' . $this->DKIM_domain .
';' .
4694 ' s=' . $this->DKIM_selector .
';' . static::$LE .
4695 ' a=' . $DKIMsignatureType .
';' .
4696 ' q=' . $DKIMquery .
';' .
4697 ' t=' . $DKIMtime .
';' .
4698 ' c=' . $DKIMcanonicalization .
';' . static::$LE .
4701 $copiedHeaderFields .
4702 ' bh=' . $DKIMb64 .
';' . static::$LE .
4706 $headerValues . static::$LE . $dkimSignatureHeader
4708 $signature = $this->
DKIM_Sign($canonicalizedHeaders);
4709 $signature = trim(chunk_split($signature, self::STD_LINE_LENGTH - 3, static::$LE . self::FWS));
4711 return static::normalizeBreaks($dkimSignatureHeader . $signature);
4724 return (
bool) preg_match(
'/^(.{' . (self::MAX_LINE_LENGTH + strlen(static::$LE)) .
',})/m', $str);
4739 if (preg_match(
'/[ ()<>@,;:"\/\[\]?=]/', $str)) {
4742 return '"' . str_replace(
'"',
'\\"', $str) .
'"';
4818 if (!empty($this->action_function) && is_callable($this->action_function)) {
4819 call_user_func($this->action_function, $isSent,
$to,
$cc,
$bcc, $subject, $body,
$from, $extra);
addAttachment( $path, $name='', $encoding=self::ENCODING_BASE64, $type='', $disposition='attachment')
Add an attachment from a path on the filesystem.
setMessageType()
Set the message type.
addBCC($address, $name='')
Add a "BCC" address.
const FWS
"Folding White Space" a white space string used for line folding.
attachmentExists()
Check if an attachment (non-inline) is present.
generateId()
Create a unique ID to use for boundaries.
if(isset($_REQUEST['delete'])) $list
getAttachments()
Return the array of attachments.
const ENCRYPTION_STARTTLS
sign($cert_filename, $key_filename, $key_pass, $extracerts_filename='')
Set the public and private key files and password for S/MIME signing.
static isValidHost($host)
Validate whether a string contains a valid value to use as a hostname or IP address.
isQmail()
Send messages using qmail.
getTranslations()
Get the array of strings for the current language.
smtpSend($header, $body)
Send mail via SMTP.
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
encodeFile($path, $encoding=self::ENCODING_BASE64)
Encode a file attachment in requested format.
encodeString($str, $encoding=self::ENCODING_BASE64)
Encode a string in requested format.
base64EncodeWrapMB($str, $linebreak=null)
Encode and wrap long multibyte strings for mail headers without breaking lines within a character...
const CONTENT_TYPE_MULTIPART_ALTERNATIVE
clearAllRecipients()
Clear all recipient types.
clearCCs()
Clear all CC recipients.
endBoundary($boundary)
Return the end of a message boundary.
sendmailSend($header, $body)
Send mail using the $Sendmail program.
alternativeExists()
Check if this message has an alternative body set.
const ICAL_METHOD_PUBLISH
getLastMessageID()
Return the Message-ID header of the last email.
createBody()
Assemble the message body.
secureHeader($str)
Strip newlines to prevent header injection.
postSend()
Actually send a message via the selected mechanism.
getOAuth()
Get the OAuth instance.
isSMTP()
Send messages using SMTP.
serverHostname()
Get the server hostname.
isError()
Check if an error occurred.
const ENCODING_QUOTED_PRINTABLE
static parseAddresses($addrstr, $useimap=true)
Parse and validate a string containing one or more RFC822-style comma-separated email addresses of th...
const ICAL_METHOD_REFRESH
const CONTENT_TYPE_MULTIPART_MIXED
getCustomHeaders()
Returns all custom headers.
const ICAL_METHOD_REQUEST
getBoundary($boundary, $charSet, $contentType, $encoding)
Return the start of a message boundary.
smtpClose()
Close the active SMTP session if one exists.
static getLE()
Return the current line break format string.
clearAttachments()
Clear all filesystem, string, and binary attachments.
encodeHeader($str, $position='text')
Encode a header value (not including its label) optimally.
validateEncoding($encoding)
Validate encodings.
encodeQP($string)
Encode a string in quoted-printable format.
static isPermittedPath($path)
Check whether a file path is of a permitted type.
edebug($str)
Output debugging info via user-defined method.
static hasLineLongerThanMax($str)
Detect if a string contains a line longer than the maximum line length allowed by RFC 2822 section 2...
addrAppend($type, $addr)
Create recipient headers.
addAnAddress($kind, $address, $name='')
Add an address to one of the recipient arrays or to the ReplyTo array.
cidExists($cid)
Check if an embedded attachment is present with this cid.
DKIM_Add($headers_line, $subject, $body)
Create the DKIM header and body in a new message header.
mail($to, $subject, $message, $additional_headers=null, $additional_parameters=null)
isHTML($isHtml=true)
Sets message type to HTML or plain.
setLanguage($langcode='en', $lang_path='')
Set the language for error messages.
static filenameToType($filename)
Map a file name to a MIME type.
utf8CharBoundary($encodedText, $maxLength)
Find the last character boundary prior to $maxLength in a utf-8 quoted-printable encoded string...
getToAddresses()
Allows for public read access to 'to' property.
getAllRecipientAddresses()
Allows for public read access to 'all_recipients' property.
const CONTENT_TYPE_MULTIPART_RELATED
DKIM_BodyC($body)
Generate a DKIM canonicalization body.
smtpConnect($options=null)
Initiate a connection to an SMTP server.
setWordWrap()
Apply word wrapping to the message body.
PHPMailer - PHP email creation and transport class.
setError($msg)
Add an error message to the error container.
html2text($html, $advanced=false)
Convert an HTML string into plain text.
getBccAddresses()
Allows for public read access to 'bcc' property.
textLine($value)
Return a formatted mail line.
getSentMIMEMessage()
Returns the whole MIME message.
$PHPMAILER_LANG['authenticate']
getReplyToAddresses()
Allows for public read access to 'ReplyTo' property.
preSend()
Prepare a message for sending.
addStringEmbeddedImage( $string, $cid, $name='', $encoding=self::ENCODING_BASE64, $type='', $disposition='inline')
Add an embedded stringified attachment.
setOAuth(OAuth $oauth)
Set an OAuth instance.
DKIM_QP($txt)
Quoted-Printable-encode a DKIM header.
inlineImageExists()
Check if an inline attachment is present.
const MAIL_MAX_LINE_LENGTH
getMailMIME()
Get the message MIME type headers.
punyencodeAddress($address)
Converts IDN in given email address to its ASCII form, also known as punycode, if possible...
clearQueuedAddresses($kind)
Clear queued addresses of given kind.
catch(Exception $e) $message
static mb_pathinfo($path, $options=null)
Multi-byte-safe pathinfo replacement.
addEmbeddedImage( $path, $cid, $name='', $encoding=self::ENCODING_BASE64, $type='', $disposition='inline')
Add an embedded (inline) attachment from a file.
const ICAL_METHOD_DECLINECOUNTER
DKIM_HeaderC($signHeader)
Generate a DKIM canonicalization header.
isMail()
Send messages using PHP's mail() function.
clearCustomHeaders()
Clear all custom headers.
addAddress($address, $name='')
Add a "To" address.
clearAddresses()
Clear all To recipients.
getCcAddresses()
Allows for public read access to 'cc' property.
doCallback($isSent, $to, $cc, $bcc, $subject, $body, $from, $extra)
Perform a callback.
$dsn
Comma separated list of DSN notifications 'NEVER' under no circumstances a DSN must be returned to th...
getSMTPInstance()
Get an instance to use for SMTP operations.
addOrEnqueueAnAddress($kind, $address, $name)
Add an address to one of the recipient arrays or to the ReplyTo array.
createHeader()
Assemble message headers.
headerLine($name, $value)
Format a header line.
setFrom($address, $name='', $auto=true)
Set the From and FromName properties.
static validateAddress($address, $patternselect=null)
Check that a string looks like an email address.
static _mime_types($ext='')
Get the MIME type for a file extension.
msgHTML($message, $basedir='', $advanced=false)
Create a message body from an HTML string.
static rfcDate()
Return an RFC 822 formatted date.
addReplyTo($address, $name='')
Add a "Reply-To" address.
isSendmail()
Send messages using $Sendmail.
has8bitChars($text)
Does a string contain any 8-bit chars (in any charset)?
addCustomHeader($name, $value=null)
Add a custom header.
const CONTENT_TYPE_TEXT_HTML
static idnSupported()
Tells whether IDNs (Internationalized Domain Names) are supported or not.
DKIM_Sign($signHeader)
Generate a DKIM signature.
send()
Create a message and send it.
OAuth - OAuth2 authentication wrapper class.
mailPassthru($to, $subject, $body, $header, $params)
Call mail() in a safe_mode-aware fashion.
const CONTENT_TYPE_TEXT_CALENDAR
const CONTENT_TYPE_PLAINTEXT
static normalizeBreaks($text, $breaktype=null)
Normalize line breaks in a string.
addStringAttachment( $string, $filename, $encoding=self::ENCODING_BASE64, $type='', $disposition='attachment')
Add a string or binary attachment (non-filesystem).
setSMTPInstance(SMTP $smtp)
Provide an instance to use for SMTP operations.
clearBCCs()
Clear all BCC recipients.
clearReplyTos()
Clear all ReplyTo recipients.
lang($key)
Get an error message in the current language.
if($path[strlen($path) - 1]==='/') if(is_dir($path)) if(!file_exists($path)) if(preg_match('#\.php$#D', mb_strtolower($path, 'UTF-8'))) $contentType
hasMultiBytes($str)
Check if a string contains multi-byte characters.
static setLE($le)
Set the line break format string, e.g.
__construct($exceptions=null)
Constructor.
addCC($address, $name='')
Add a "CC" address.
static quotedString($str)
If a string contains any "special" characters, double-quote the name, and escape any double quotes wi...
if(!array_key_exists('domain', $_REQUEST)) $domain
static stripTrailingWSP($text)
Remove trailing breaks from a string.
PHPMailer RFC821 SMTP email transport class.
hash(StreamInterface $stream, $algo, $rawOutput=false)
Calculate a hash of a Stream.
attachAll($disposition_type, $boundary)
Attach all file, string, and binary attachments to the message.
wrapText($message, $length, $qp_mode=false)
Word-wrap message.
static isShellSafe($string)
Fix CVE-2016-10033 and CVE-2016-10045 by disallowing potentially unsafe shell characters.
const CRLF
The SMTP standard CRLF line break.
mailSend($header, $body)
Send mail using the PHP mail() function.
encodeQ($str, $position='text')
Encode a string using Q encoding.
addrFormat($addr)
Format an address for use in a message header.
const ICAL_METHOD_COUNTER
Get an OAuth2 token from an OAuth2 provider.