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 === stripos($ini_sendmail_path, 'qmail')) {
[1000] Fix | Delete
$this->Sendmail = '/var/qmail/bin/qmail-inject';
[1001] Fix | Delete
} else {
[1002] Fix | Delete
$this->Sendmail = $ini_sendmail_path;
[1003] Fix | Delete
}
[1004] Fix | Delete
$this->Mailer = 'qmail';
[1005] Fix | Delete
}
[1006] Fix | Delete
[1007] Fix | Delete
/**
[1008] Fix | Delete
* Add a "To" address.
[1009] Fix | Delete
*
[1010] Fix | Delete
* @param string $address The email address to send to
[1011] Fix | Delete
* @param string $name
[1012] Fix | Delete
*
[1013] Fix | Delete
* @throws Exception
[1014] Fix | Delete
*
[1015] Fix | Delete
* @return bool true on success, false if address already used or invalid in some way
[1016] Fix | Delete
*/
[1017] Fix | Delete
public function addAddress($address, $name = '')
[1018] Fix | Delete
{
[1019] Fix | Delete
return $this->addOrEnqueueAnAddress('to', $address, $name);
[1020] Fix | Delete
}
[1021] Fix | Delete
[1022] Fix | Delete
/**
[1023] Fix | Delete
* Add a "CC" address.
[1024] Fix | Delete
*
[1025] Fix | Delete
* @param string $address The email address to send to
[1026] Fix | Delete
* @param string $name
[1027] Fix | Delete
*
[1028] Fix | Delete
* @throws Exception
[1029] Fix | Delete
*
[1030] Fix | Delete
* @return bool true on success, false if address already used or invalid in some way
[1031] Fix | Delete
*/
[1032] Fix | Delete
public function addCC($address, $name = '')
[1033] Fix | Delete
{
[1034] Fix | Delete
return $this->addOrEnqueueAnAddress('cc', $address, $name);
[1035] Fix | Delete
}
[1036] Fix | Delete
[1037] Fix | Delete
/**
[1038] Fix | Delete
* Add a "BCC" address.
[1039] Fix | Delete
*
[1040] Fix | Delete
* @param string $address The email address to send to
[1041] Fix | Delete
* @param string $name
[1042] Fix | Delete
*
[1043] Fix | Delete
* @throws Exception
[1044] Fix | Delete
*
[1045] Fix | Delete
* @return bool true on success, false if address already used or invalid in some way
[1046] Fix | Delete
*/
[1047] Fix | Delete
public function addBCC($address, $name = '')
[1048] Fix | Delete
{
[1049] Fix | Delete
return $this->addOrEnqueueAnAddress('bcc', $address, $name);
[1050] Fix | Delete
}
[1051] Fix | Delete
[1052] Fix | Delete
/**
[1053] Fix | Delete
* Add a "Reply-To" address.
[1054] Fix | Delete
*
[1055] Fix | Delete
* @param string $address The email address to reply to
[1056] Fix | Delete
* @param string $name
[1057] Fix | Delete
*
[1058] Fix | Delete
* @throws Exception
[1059] Fix | Delete
*
[1060] Fix | Delete
* @return bool true on success, false if address already used or invalid in some way
[1061] Fix | Delete
*/
[1062] Fix | Delete
public function addReplyTo($address, $name = '')
[1063] Fix | Delete
{
[1064] Fix | Delete
return $this->addOrEnqueueAnAddress('Reply-To', $address, $name);
[1065] Fix | Delete
}
[1066] Fix | Delete
[1067] Fix | Delete
/**
[1068] Fix | Delete
* Add an address to one of the recipient arrays or to the ReplyTo array. Because PHPMailer
[1069] Fix | Delete
* can't validate addresses with an IDN without knowing the PHPMailer::$CharSet (that can still
[1070] Fix | Delete
* be modified after calling this function), addition of such addresses is delayed until send().
[1071] Fix | Delete
* Addresses that have been added already return false, but do not throw exceptions.
[1072] Fix | Delete
*
[1073] Fix | Delete
* @param string $kind One of 'to', 'cc', 'bcc', or 'ReplyTo'
[1074] Fix | Delete
* @param string $address The email address
[1075] Fix | Delete
* @param string $name An optional username associated with the address
[1076] Fix | Delete
*
[1077] Fix | Delete
* @throws Exception
[1078] Fix | Delete
*
[1079] Fix | Delete
* @return bool true on success, false if address already used or invalid in some way
[1080] Fix | Delete
*/
[1081] Fix | Delete
protected function addOrEnqueueAnAddress($kind, $address, $name)
[1082] Fix | Delete
{
[1083] Fix | Delete
$pos = false;
[1084] Fix | Delete
if ($address !== null) {
[1085] Fix | Delete
$address = trim($address);
[1086] Fix | Delete
$pos = strrpos($address, '@');
[1087] Fix | Delete
}
[1088] Fix | Delete
if (false === $pos) {
[1089] Fix | Delete
//At-sign is missing.
[1090] Fix | Delete
$error_message = sprintf(
[1091] Fix | Delete
'%s (%s): %s',
[1092] Fix | Delete
$this->lang('invalid_address'),
[1093] Fix | Delete
$kind,
[1094] Fix | Delete
$address
[1095] Fix | Delete
);
[1096] Fix | Delete
$this->setError($error_message);
[1097] Fix | Delete
$this->edebug($error_message);
[1098] Fix | Delete
if ($this->exceptions) {
[1099] Fix | Delete
throw new Exception($error_message);
[1100] Fix | Delete
}
[1101] Fix | Delete
[1102] Fix | Delete
return false;
[1103] Fix | Delete
}
[1104] Fix | Delete
if ($name !== null && is_string($name)) {
[1105] Fix | Delete
$name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
[1106] Fix | Delete
} else {
[1107] Fix | Delete
$name = '';
[1108] Fix | Delete
}
[1109] Fix | Delete
$params = [$kind, $address, $name];
[1110] Fix | Delete
//Enqueue addresses with IDN until we know the PHPMailer::$CharSet.
[1111] Fix | Delete
//Domain is assumed to be whatever is after the last @ symbol in the address
[1112] Fix | Delete
if (static::idnSupported() && $this->has8bitChars(substr($address, ++$pos))) {
[1113] Fix | Delete
if ('Reply-To' !== $kind) {
[1114] Fix | Delete
if (!array_key_exists($address, $this->RecipientsQueue)) {
[1115] Fix | Delete
$this->RecipientsQueue[$address] = $params;
[1116] Fix | Delete
[1117] Fix | Delete
return true;
[1118] Fix | Delete
}
[1119] Fix | Delete
} elseif (!array_key_exists($address, $this->ReplyToQueue)) {
[1120] Fix | Delete
$this->ReplyToQueue[$address] = $params;
[1121] Fix | Delete
[1122] Fix | Delete
return true;
[1123] Fix | Delete
}
[1124] Fix | Delete
[1125] Fix | Delete
return false;
[1126] Fix | Delete
}
[1127] Fix | Delete
[1128] Fix | Delete
//Immediately add standard addresses without IDN.
[1129] Fix | Delete
return call_user_func_array([$this, 'addAnAddress'], $params);
[1130] Fix | Delete
}
[1131] Fix | Delete
[1132] Fix | Delete
/**
[1133] Fix | Delete
* Set the boundaries to use for delimiting MIME parts.
[1134] Fix | Delete
* If you override this, ensure you set all 3 boundaries to unique values.
[1135] Fix | Delete
* The default boundaries include a "=_" sequence which cannot occur in quoted-printable bodies,
[1136] Fix | Delete
* as suggested by https://www.rfc-editor.org/rfc/rfc2045#section-6.7
[1137] Fix | Delete
*
[1138] Fix | Delete
* @return void
[1139] Fix | Delete
*/
[1140] Fix | Delete
public function setBoundaries()
[1141] Fix | Delete
{
[1142] Fix | Delete
$this->uniqueid = $this->generateId();
[1143] Fix | Delete
$this->boundary[1] = 'b1=_' . $this->uniqueid;
[1144] Fix | Delete
$this->boundary[2] = 'b2=_' . $this->uniqueid;
[1145] Fix | Delete
$this->boundary[3] = 'b3=_' . $this->uniqueid;
[1146] Fix | Delete
}
[1147] Fix | Delete
[1148] Fix | Delete
/**
[1149] Fix | Delete
* Add an address to one of the recipient arrays or to the ReplyTo array.
[1150] Fix | Delete
* Addresses that have been added already return false, but do not throw exceptions.
[1151] Fix | Delete
*
[1152] Fix | Delete
* @param string $kind One of 'to', 'cc', 'bcc', or 'ReplyTo'
[1153] Fix | Delete
* @param string $address The email address to send, resp. to reply to
[1154] Fix | Delete
* @param string $name
[1155] Fix | Delete
*
[1156] Fix | Delete
* @throws Exception
[1157] Fix | Delete
*
[1158] Fix | Delete
* @return bool true on success, false if address already used or invalid in some way
[1159] Fix | Delete
*/
[1160] Fix | Delete
protected function addAnAddress($kind, $address, $name = '')
[1161] Fix | Delete
{
[1162] Fix | Delete
if (!in_array($kind, ['to', 'cc', 'bcc', 'Reply-To'])) {
[1163] Fix | Delete
$error_message = sprintf(
[1164] Fix | Delete
'%s: %s',
[1165] Fix | Delete
$this->lang('Invalid recipient kind'),
[1166] Fix | Delete
$kind
[1167] Fix | Delete
);
[1168] Fix | Delete
$this->setError($error_message);
[1169] Fix | Delete
$this->edebug($error_message);
[1170] Fix | Delete
if ($this->exceptions) {
[1171] Fix | Delete
throw new Exception($error_message);
[1172] Fix | Delete
}
[1173] Fix | Delete
[1174] Fix | Delete
return false;
[1175] Fix | Delete
}
[1176] Fix | Delete
if (!static::validateAddress($address)) {
[1177] Fix | Delete
$error_message = sprintf(
[1178] Fix | Delete
'%s (%s): %s',
[1179] Fix | Delete
$this->lang('invalid_address'),
[1180] Fix | Delete
$kind,
[1181] Fix | Delete
$address
[1182] Fix | Delete
);
[1183] Fix | Delete
$this->setError($error_message);
[1184] Fix | Delete
$this->edebug($error_message);
[1185] Fix | Delete
if ($this->exceptions) {
[1186] Fix | Delete
throw new Exception($error_message);
[1187] Fix | Delete
}
[1188] Fix | Delete
[1189] Fix | Delete
return false;
[1190] Fix | Delete
}
[1191] Fix | Delete
if ('Reply-To' !== $kind) {
[1192] Fix | Delete
if (!array_key_exists(strtolower($address), $this->all_recipients)) {
[1193] Fix | Delete
$this->{$kind}[] = [$address, $name];
[1194] Fix | Delete
$this->all_recipients[strtolower($address)] = true;
[1195] Fix | Delete
[1196] Fix | Delete
return true;
[1197] Fix | Delete
}
[1198] Fix | Delete
} elseif (!array_key_exists(strtolower($address), $this->ReplyTo)) {
[1199] Fix | Delete
$this->ReplyTo[strtolower($address)] = [$address, $name];
[1200] Fix | Delete
[1201] Fix | Delete
return true;
[1202] Fix | Delete
}
[1203] Fix | Delete
[1204] Fix | Delete
return false;
[1205] Fix | Delete
}
[1206] Fix | Delete
[1207] Fix | Delete
/**
[1208] Fix | Delete
* Parse and validate a string containing one or more RFC822-style comma-separated email addresses
[1209] Fix | Delete
* of the form "display name <address>" into an array of name/address pairs.
[1210] Fix | Delete
* Uses the imap_rfc822_parse_adrlist function if the IMAP extension is available.
[1211] Fix | Delete
* Note that quotes in the name part are removed.
[1212] Fix | Delete
*
[1213] Fix | Delete
* @see http://www.andrew.cmu.edu/user/agreen1/testing/mrbs/web/Mail/RFC822.php A more careful implementation
[1214] Fix | Delete
*
[1215] Fix | Delete
* @param string $addrstr The address list string
[1216] Fix | Delete
* @param bool $useimap Whether to use the IMAP extension to parse the list
[1217] Fix | Delete
* @param string $charset The charset to use when decoding the address list string.
[1218] Fix | Delete
*
[1219] Fix | Delete
* @return array
[1220] Fix | Delete
*/
[1221] Fix | Delete
public static function parseAddresses($addrstr, $useimap = true, $charset = self::CHARSET_ISO88591)
[1222] Fix | Delete
{
[1223] Fix | Delete
$addresses = [];
[1224] Fix | Delete
if ($useimap && function_exists('imap_rfc822_parse_adrlist')) {
[1225] Fix | Delete
//Use this built-in parser if it's available
[1226] Fix | Delete
$list = imap_rfc822_parse_adrlist($addrstr, '');
[1227] Fix | Delete
// Clear any potential IMAP errors to get rid of notices being thrown at end of script.
[1228] Fix | Delete
imap_errors();
[1229] Fix | Delete
foreach ($list as $address) {
[1230] Fix | Delete
if (
[1231] Fix | Delete
'.SYNTAX-ERROR.' !== $address->host &&
[1232] Fix | Delete
static::validateAddress($address->mailbox . '@' . $address->host)
[1233] Fix | Delete
) {
[1234] Fix | Delete
//Decode the name part if it's present and encoded
[1235] Fix | Delete
if (
[1236] Fix | Delete
property_exists($address, 'personal') &&
[1237] Fix | Delete
//Check for a Mbstring constant rather than using extension_loaded, which is sometimes disabled
[1238] Fix | Delete
defined('MB_CASE_UPPER') &&
[1239] Fix | Delete
preg_match('/^=\?.*\?=$/s', $address->personal)
[1240] Fix | Delete
) {
[1241] Fix | Delete
$origCharset = mb_internal_encoding();
[1242] Fix | Delete
mb_internal_encoding($charset);
[1243] Fix | Delete
//Undo any RFC2047-encoded spaces-as-underscores
[1244] Fix | Delete
$address->personal = str_replace('_', '=20', $address->personal);
[1245] Fix | Delete
//Decode the name
[1246] Fix | Delete
$address->personal = mb_decode_mimeheader($address->personal);
[1247] Fix | Delete
mb_internal_encoding($origCharset);
[1248] Fix | Delete
}
[1249] Fix | Delete
[1250] Fix | Delete
$addresses[] = [
[1251] Fix | Delete
'name' => (property_exists($address, 'personal') ? $address->personal : ''),
[1252] Fix | Delete
'address' => $address->mailbox . '@' . $address->host,
[1253] Fix | Delete
];
[1254] Fix | Delete
}
[1255] Fix | Delete
}
[1256] Fix | Delete
} else {
[1257] Fix | Delete
//Use this simpler parser
[1258] Fix | Delete
$list = explode(',', $addrstr);
[1259] Fix | Delete
foreach ($list as $address) {
[1260] Fix | Delete
$address = trim($address);
[1261] Fix | Delete
//Is there a separate name part?
[1262] Fix | Delete
if (strpos($address, '<') === false) {
[1263] Fix | Delete
//No separate name, just use the whole thing
[1264] Fix | Delete
if (static::validateAddress($address)) {
[1265] Fix | Delete
$addresses[] = [
[1266] Fix | Delete
'name' => '',
[1267] Fix | Delete
'address' => $address,
[1268] Fix | Delete
];
[1269] Fix | Delete
}
[1270] Fix | Delete
} else {
[1271] Fix | Delete
list($name, $email) = explode('<', $address);
[1272] Fix | Delete
$email = trim(str_replace('>', '', $email));
[1273] Fix | Delete
$name = trim($name);
[1274] Fix | Delete
if (static::validateAddress($email)) {
[1275] Fix | Delete
//Check for a Mbstring constant rather than using extension_loaded, which is sometimes disabled
[1276] Fix | Delete
//If this name is encoded, decode it
[1277] Fix | Delete
if (defined('MB_CASE_UPPER') && preg_match('/^=\?.*\?=$/s', $name)) {
[1278] Fix | Delete
$origCharset = mb_internal_encoding();
[1279] Fix | Delete
mb_internal_encoding($charset);
[1280] Fix | Delete
//Undo any RFC2047-encoded spaces-as-underscores
[1281] Fix | Delete
$name = str_replace('_', '=20', $name);
[1282] Fix | Delete
//Decode the name
[1283] Fix | Delete
$name = mb_decode_mimeheader($name);
[1284] Fix | Delete
mb_internal_encoding($origCharset);
[1285] Fix | Delete
}
[1286] Fix | Delete
$addresses[] = [
[1287] Fix | Delete
//Remove any surrounding quotes and spaces from the name
[1288] Fix | Delete
'name' => trim($name, '\'" '),
[1289] Fix | Delete
'address' => $email,
[1290] Fix | Delete
];
[1291] Fix | Delete
}
[1292] Fix | Delete
}
[1293] Fix | Delete
}
[1294] Fix | Delete
}
[1295] Fix | Delete
[1296] Fix | Delete
return $addresses;
[1297] Fix | Delete
}
[1298] Fix | Delete
[1299] Fix | Delete
/**
[1300] Fix | Delete
* Set the From and FromName properties.
[1301] Fix | Delete
*
[1302] Fix | Delete
* @param string $address
[1303] Fix | Delete
* @param string $name
[1304] Fix | Delete
* @param bool $auto Whether to also set the Sender address, defaults to true
[1305] Fix | Delete
*
[1306] Fix | Delete
* @throws Exception
[1307] Fix | Delete
*
[1308] Fix | Delete
* @return bool
[1309] Fix | Delete
*/
[1310] Fix | Delete
public function setFrom($address, $name = '', $auto = true)
[1311] Fix | Delete
{
[1312] Fix | Delete
$address = trim((string)$address);
[1313] Fix | Delete
$name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
[1314] Fix | Delete
//Don't validate now addresses with IDN. Will be done in send().
[1315] Fix | Delete
$pos = strrpos($address, '@');
[1316] Fix | Delete
if (
[1317] Fix | Delete
(false === $pos)
[1318] Fix | Delete
|| ((!$this->has8bitChars(substr($address, ++$pos)) || !static::idnSupported())
[1319] Fix | Delete
&& !static::validateAddress($address))
[1320] Fix | Delete
) {
[1321] Fix | Delete
$error_message = sprintf(
[1322] Fix | Delete
'%s (From): %s',
[1323] Fix | Delete
$this->lang('invalid_address'),
[1324] Fix | Delete
$address
[1325] Fix | Delete
);
[1326] Fix | Delete
$this->setError($error_message);
[1327] Fix | Delete
$this->edebug($error_message);
[1328] Fix | Delete
if ($this->exceptions) {
[1329] Fix | Delete
throw new Exception($error_message);
[1330] Fix | Delete
}
[1331] Fix | Delete
[1332] Fix | Delete
return false;
[1333] Fix | Delete
}
[1334] Fix | Delete
$this->From = $address;
[1335] Fix | Delete
$this->FromName = $name;
[1336] Fix | Delete
if ($auto && empty($this->Sender)) {
[1337] Fix | Delete
$this->Sender = $address;
[1338] Fix | Delete
}
[1339] Fix | Delete
[1340] Fix | Delete
return true;
[1341] Fix | Delete
}
[1342] Fix | Delete
[1343] Fix | Delete
/**
[1344] Fix | Delete
* Return the Message-ID header of the last email.
[1345] Fix | Delete
* Technically this is the value from the last time the headers were created,
[1346] Fix | Delete
* but it's also the message ID of the last sent message except in
[1347] Fix | Delete
* pathological cases.
[1348] Fix | Delete
*
[1349] Fix | Delete
* @return string
[1350] Fix | Delete
*/
[1351] Fix | Delete
public function getLastMessageID()
[1352] Fix | Delete
{
[1353] Fix | Delete
return $this->lastMessageID;
[1354] Fix | Delete
}
[1355] Fix | Delete
[1356] Fix | Delete
/**
[1357] Fix | Delete
* Check that a string looks like an email address.
[1358] Fix | Delete
* Validation patterns supported:
[1359] Fix | Delete
* * `auto` Pick best pattern automatically;
[1360] Fix | Delete
* * `pcre8` Use the squiloople.com pattern, requires PCRE > 8.0;
[1361] Fix | Delete
* * `pcre` Use old PCRE implementation;
[1362] Fix | Delete
* * `php` Use PHP built-in FILTER_VALIDATE_EMAIL;
[1363] Fix | Delete
* * `html5` Use the pattern given by the HTML5 spec for 'email' type form input elements.
[1364] Fix | Delete
* * `noregex` Don't use a regex: super fast, really dumb.
[1365] Fix | Delete
* Alternatively you may pass in a callable to inject your own validator, for example:
[1366] Fix | Delete
*
[1367] Fix | Delete
* ```php
[1368] Fix | Delete
* PHPMailer::validateAddress('user@example.com', function($address) {
[1369] Fix | Delete
* return (strpos($address, '@') !== false);
[1370] Fix | Delete
* });
[1371] Fix | Delete
* ```
[1372] Fix | Delete
*
[1373] Fix | Delete
* You can also set the PHPMailer::$validator static to a callable, allowing built-in methods to use your validator.
[1374] Fix | Delete
*
[1375] Fix | Delete
* @param string $address The email address to check
[1376] Fix | Delete
* @param string|callable $patternselect Which pattern to use
[1377] Fix | Delete
*
[1378] Fix | Delete
* @return bool
[1379] Fix | Delete
*/
[1380] Fix | Delete
public static function validateAddress($address, $patternselect = null)
[1381] Fix | Delete
{
[1382] Fix | Delete
if (null === $patternselect) {
[1383] Fix | Delete
$patternselect = static::$validator;
[1384] Fix | Delete
}
[1385] Fix | Delete
//Don't allow strings as callables, see SECURITY.md and CVE-2021-3603
[1386] Fix | Delete
if (is_callable($patternselect) && !is_string($patternselect)) {
[1387] Fix | Delete
return call_user_func($patternselect, $address);
[1388] Fix | Delete
}
[1389] Fix | Delete
//Reject line breaks in addresses; it's valid RFC5322, but not RFC5321
[1390] Fix | Delete
if (strpos($address, "\n") !== false || strpos($address, "\r") !== false) {
[1391] Fix | Delete
return false;
[1392] Fix | Delete
}
[1393] Fix | Delete
switch ($patternselect) {
[1394] Fix | Delete
case 'pcre': //Kept for BC
[1395] Fix | Delete
case 'pcre8':
[1396] Fix | Delete
/*
[1397] Fix | Delete
* A more complex and more permissive version of the RFC5322 regex on which FILTER_VALIDATE_EMAIL
[1398] Fix | Delete
* is based.
[1399] Fix | Delete
* In addition to the addresses allowed by filter_var, also permits:
[1400] Fix | Delete
* * dotless domains: `a@b`
[1401] Fix | Delete
* * comments: `1234 @ local(blah) .machine .example`
[1402] Fix | Delete
* * quoted elements: `'"test blah"@example.org'`
[1403] Fix | Delete
* * numeric TLDs: `a@b.123`
[1404] Fix | Delete
* * unbracketed IPv4 literals: `a@192.168.0.1`
[1405] Fix | Delete
* * IPv6 literals: 'first.last@[IPv6:a1::]'
[1406] Fix | Delete
* Not all of these will necessarily work for sending!
[1407] Fix | Delete
*
[1408] Fix | Delete
* @see http://squiloople.com/2009/12/20/email-address-validation/
[1409] Fix | Delete
* @copyright 2009-2010 Michael Rushton
[1410] Fix | Delete
* Feel free to use and redistribute this code. But please keep this copyright notice.
[1411] Fix | Delete
*/
[1412] Fix | Delete
return (bool) preg_match(
[1413] Fix | Delete
'/^(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){255,})(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){65,}@)' .
[1414] Fix | Delete
'((?>(?>(?>((?>(?>(?>\x0D\x0A)?[\t ])+|(?>[\t ]*\x0D\x0A)?[\t ]+)?)(\((?>(?2)' .
[1415] Fix | Delete
'(?>[\x01-\x08\x0B\x0C\x0E-\'*-\[\]-\x7F]|\\\[\x00-\x7F]|(?3)))*(?2)\)))+(?2))|(?2))?)' .
[1416] Fix | Delete
'([!#-\'*+\/-9=?^-~-]+|"(?>(?2)(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\x7F]))*' .
[1417] Fix | Delete
'(?2)")(?>(?1)\.(?1)(?4))*(?1)@(?!(?1)[a-z0-9-]{64,})(?1)(?>([a-z0-9](?>[a-z0-9-]*[a-z0-9])?)' .
[1418] Fix | Delete
'(?>(?1)\.(?!(?1)[a-z0-9-]{64,})(?1)(?5)){0,126}|\[(?:(?>IPv6:(?>([a-f0-9]{1,4})(?>:(?6)){7}' .
[1419] Fix | Delete
'|(?!(?:.*[a-f0-9][:\]]){8,})((?6)(?>:(?6)){0,6})?::(?7)?))|(?>(?>IPv6:(?>(?6)(?>:(?6)){5}:' .
[1420] Fix | Delete
'|(?!(?:.*[a-f0-9]:){6,})(?8)?::(?>((?6)(?>:(?6)){0,4}):)?))?(25[0-5]|2[0-4][0-9]|1[0-9]{2}' .
[1421] Fix | Delete
'|[1-9]?[0-9])(?>\.(?9)){3}))\])(?1)$/isD',
[1422] Fix | Delete
$address
[1423] Fix | Delete
);
[1424] Fix | Delete
case 'html5':
[1425] Fix | Delete
/*
[1426] Fix | Delete
* This is the pattern used in the HTML5 spec for validation of 'email' type form input elements.
[1427] Fix | Delete
*
[1428] Fix | Delete
* @see https://html.spec.whatwg.org/#e-mail-state-(type=email)
[1429] Fix | Delete
*/
[1430] Fix | Delete
return (bool) preg_match(
[1431] Fix | Delete
'/^[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}' .
[1432] Fix | Delete
'[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/sD',
[1433] Fix | Delete
$address
[1434] Fix | Delete
);
[1435] Fix | Delete
case 'php':
[1436] Fix | Delete
default:
[1437] Fix | Delete
return filter_var($address, FILTER_VALIDATE_EMAIL) !== false;
[1438] Fix | Delete
}
[1439] Fix | Delete
}
[1440] Fix | Delete
[1441] Fix | Delete
/**
[1442] Fix | Delete
* Tells whether IDNs (Internationalized Domain Names) are supported or not. This requires the
[1443] Fix | Delete
* `intl` and `mbstring` PHP extensions.
[1444] Fix | Delete
*
[1445] Fix | Delete
* @return bool `true` if required functions for IDN support are present
[1446] Fix | Delete
*/
[1447] Fix | Delete
public static function idnSupported()
[1448] Fix | Delete
{
[1449] Fix | Delete
return function_exists('idn_to_ascii') && function_exists('mb_convert_encoding');
[1450] Fix | Delete
}
[1451] Fix | Delete
[1452] Fix | Delete
/**
[1453] Fix | Delete
* Converts IDN in given email address to its ASCII form, also known as punycode, if possible.
[1454] Fix | Delete
* Important: Address must be passed in same encoding as currently set in PHPMailer::$CharSet.
[1455] Fix | Delete
* This function silently returns unmodified address if:
[1456] Fix | Delete
* - No conversion is necessary (i.e. domain name is not an IDN, or is already in ASCII form)
[1457] Fix | Delete
* - Conversion to punycode is impossible (e.g. required PHP functions are not available)
[1458] Fix | Delete
* or fails for any reason (e.g. domain contains characters not allowed in an IDN).
[1459] Fix | Delete
*
[1460] Fix | Delete
* @see PHPMailer::$CharSet
[1461] Fix | Delete
*
[1462] Fix | Delete
* @param string $address The email address to convert
[1463] Fix | Delete
*
[1464] Fix | Delete
* @return string The encoded address in ASCII form
[1465] Fix | Delete
*/
[1466] Fix | Delete
public function punyencodeAddress($address)
[1467] Fix | Delete
{
[1468] Fix | Delete
//Verify we have required functions, CharSet, and at-sign.
[1469] Fix | Delete
$pos = strrpos($address, '@');
[1470] Fix | Delete
if (
[1471] Fix | Delete
!empty($this->CharSet) &&
[1472] Fix | Delete
false !== $pos &&
[1473] Fix | Delete
static::idnSupported()
[1474] Fix | Delete
) {
[1475] Fix | Delete
$domain = substr($address, ++$pos);
[1476] Fix | Delete
//Verify CharSet string is a valid one, and domain properly encoded in this CharSet.
[1477] Fix | Delete
if ($this->has8bitChars($domain) && @mb_check_encoding($domain, $this->CharSet)) {
[1478] Fix | Delete
//Convert the domain from whatever charset it's in to UTF-8
[1479] Fix | Delete
$domain = mb_convert_encoding($domain, self::CHARSET_UTF8, $this->CharSet);
[1480] Fix | Delete
//Ignore IDE complaints about this line - method signature changed in PHP 5.4
[1481] Fix | Delete
$errorcode = 0;
[1482] Fix | Delete
if (defined('INTL_IDNA_VARIANT_UTS46')) {
[1483] Fix | Delete
//Use the current punycode standard (appeared in PHP 7.2)
[1484] Fix | Delete
$punycode = idn_to_ascii(
[1485] Fix | Delete
$domain,
[1486] Fix | Delete
\IDNA_DEFAULT | \IDNA_USE_STD3_RULES | \IDNA_CHECK_BIDI |
[1487] Fix | Delete
\IDNA_CHECK_CONTEXTJ | \IDNA_NONTRANSITIONAL_TO_ASCII,
[1488] Fix | Delete
\INTL_IDNA_VARIANT_UTS46
[1489] Fix | Delete
);
[1490] Fix | Delete
} elseif (defined('INTL_IDNA_VARIANT_2003')) {
[1491] Fix | Delete
//Fall back to this old, deprecated/removed encoding
[1492] Fix | Delete
// phpcs:ignore PHPCompatibility.Constants.RemovedConstants.intl_idna_variant_2003Deprecated
[1493] Fix | Delete
$punycode = idn_to_ascii($domain, $errorcode, \INTL_IDNA_VARIANT_2003);
[1494] Fix | Delete
} else {
[1495] Fix | Delete
//Fall back to a default we don't know about
[1496] Fix | Delete
// phpcs:ignore PHPCompatibility.ParameterValues.NewIDNVariantDefault.NotSet
[1497] Fix | Delete
$punycode = idn_to_ascii($domain, $errorcode);
[1498] Fix | Delete
}
[1499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function