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: SMTP.php
* @see hello()
[500] Fix | Delete
*
[501] Fix | Delete
* @param string $username The user name
[502] Fix | Delete
* @param string $password The password
[503] Fix | Delete
* @param string $authtype The auth type (CRAM-MD5, PLAIN, LOGIN, XOAUTH2)
[504] Fix | Delete
* @param OAuthTokenProvider $OAuth An optional OAuthTokenProvider instance for XOAUTH2 authentication
[505] Fix | Delete
*
[506] Fix | Delete
* @return bool True if successfully authenticated
[507] Fix | Delete
*/
[508] Fix | Delete
public function authenticate(
[509] Fix | Delete
$username,
[510] Fix | Delete
$password,
[511] Fix | Delete
$authtype = null,
[512] Fix | Delete
$OAuth = null
[513] Fix | Delete
) {
[514] Fix | Delete
if (!$this->server_caps) {
[515] Fix | Delete
$this->setError('Authentication is not allowed before HELO/EHLO');
[516] Fix | Delete
[517] Fix | Delete
return false;
[518] Fix | Delete
}
[519] Fix | Delete
[520] Fix | Delete
if (array_key_exists('EHLO', $this->server_caps)) {
[521] Fix | Delete
//SMTP extensions are available; try to find a proper authentication method
[522] Fix | Delete
if (!array_key_exists('AUTH', $this->server_caps)) {
[523] Fix | Delete
$this->setError('Authentication is not allowed at this stage');
[524] Fix | Delete
//'at this stage' means that auth may be allowed after the stage changes
[525] Fix | Delete
//e.g. after STARTTLS
[526] Fix | Delete
[527] Fix | Delete
return false;
[528] Fix | Delete
}
[529] Fix | Delete
[530] Fix | Delete
$this->edebug('Auth method requested: ' . ($authtype ?: 'UNSPECIFIED'), self::DEBUG_LOWLEVEL);
[531] Fix | Delete
$this->edebug(
[532] Fix | Delete
'Auth methods available on the server: ' . implode(',', $this->server_caps['AUTH']),
[533] Fix | Delete
self::DEBUG_LOWLEVEL
[534] Fix | Delete
);
[535] Fix | Delete
[536] Fix | Delete
//If we have requested a specific auth type, check the server supports it before trying others
[537] Fix | Delete
if (null !== $authtype && !in_array($authtype, $this->server_caps['AUTH'], true)) {
[538] Fix | Delete
$this->edebug('Requested auth method not available: ' . $authtype, self::DEBUG_LOWLEVEL);
[539] Fix | Delete
$authtype = null;
[540] Fix | Delete
}
[541] Fix | Delete
[542] Fix | Delete
if (empty($authtype)) {
[543] Fix | Delete
//If no auth mechanism is specified, attempt to use these, in this order
[544] Fix | Delete
//Try CRAM-MD5 first as it's more secure than the others
[545] Fix | Delete
foreach (['CRAM-MD5', 'LOGIN', 'PLAIN', 'XOAUTH2'] as $method) {
[546] Fix | Delete
if (in_array($method, $this->server_caps['AUTH'], true)) {
[547] Fix | Delete
$authtype = $method;
[548] Fix | Delete
break;
[549] Fix | Delete
}
[550] Fix | Delete
}
[551] Fix | Delete
if (empty($authtype)) {
[552] Fix | Delete
$this->setError('No supported authentication methods found');
[553] Fix | Delete
[554] Fix | Delete
return false;
[555] Fix | Delete
}
[556] Fix | Delete
$this->edebug('Auth method selected: ' . $authtype, self::DEBUG_LOWLEVEL);
[557] Fix | Delete
}
[558] Fix | Delete
[559] Fix | Delete
if (!in_array($authtype, $this->server_caps['AUTH'], true)) {
[560] Fix | Delete
$this->setError("The requested authentication method \"$authtype\" is not supported by the server");
[561] Fix | Delete
[562] Fix | Delete
return false;
[563] Fix | Delete
}
[564] Fix | Delete
} elseif (empty($authtype)) {
[565] Fix | Delete
$authtype = 'LOGIN';
[566] Fix | Delete
}
[567] Fix | Delete
switch ($authtype) {
[568] Fix | Delete
case 'PLAIN':
[569] Fix | Delete
//Start authentication
[570] Fix | Delete
if (!$this->sendCommand('AUTH', 'AUTH PLAIN', 334)) {
[571] Fix | Delete
return false;
[572] Fix | Delete
}
[573] Fix | Delete
//Send encoded username and password
[574] Fix | Delete
if (
[575] Fix | Delete
//Format from https://tools.ietf.org/html/rfc4616#section-2
[576] Fix | Delete
//We skip the first field (it's forgery), so the string starts with a null byte
[577] Fix | Delete
!$this->sendCommand(
[578] Fix | Delete
'User & Password',
[579] Fix | Delete
base64_encode("\0" . $username . "\0" . $password),
[580] Fix | Delete
235
[581] Fix | Delete
)
[582] Fix | Delete
) {
[583] Fix | Delete
return false;
[584] Fix | Delete
}
[585] Fix | Delete
break;
[586] Fix | Delete
case 'LOGIN':
[587] Fix | Delete
//Start authentication
[588] Fix | Delete
if (!$this->sendCommand('AUTH', 'AUTH LOGIN', 334)) {
[589] Fix | Delete
return false;
[590] Fix | Delete
}
[591] Fix | Delete
if (!$this->sendCommand('Username', base64_encode($username), 334)) {
[592] Fix | Delete
return false;
[593] Fix | Delete
}
[594] Fix | Delete
if (!$this->sendCommand('Password', base64_encode($password), 235)) {
[595] Fix | Delete
return false;
[596] Fix | Delete
}
[597] Fix | Delete
break;
[598] Fix | Delete
case 'CRAM-MD5':
[599] Fix | Delete
//Start authentication
[600] Fix | Delete
if (!$this->sendCommand('AUTH CRAM-MD5', 'AUTH CRAM-MD5', 334)) {
[601] Fix | Delete
return false;
[602] Fix | Delete
}
[603] Fix | Delete
//Get the challenge
[604] Fix | Delete
$challenge = base64_decode(substr($this->last_reply, 4));
[605] Fix | Delete
[606] Fix | Delete
//Build the response
[607] Fix | Delete
$response = $username . ' ' . $this->hmac($challenge, $password);
[608] Fix | Delete
[609] Fix | Delete
//send encoded credentials
[610] Fix | Delete
return $this->sendCommand('Username', base64_encode($response), 235);
[611] Fix | Delete
case 'XOAUTH2':
[612] Fix | Delete
//The OAuth instance must be set up prior to requesting auth.
[613] Fix | Delete
if (null === $OAuth) {
[614] Fix | Delete
return false;
[615] Fix | Delete
}
[616] Fix | Delete
$oauth = $OAuth->getOauth64();
[617] Fix | Delete
[618] Fix | Delete
//Start authentication
[619] Fix | Delete
if (!$this->sendCommand('AUTH', 'AUTH XOAUTH2 ' . $oauth, 235)) {
[620] Fix | Delete
return false;
[621] Fix | Delete
}
[622] Fix | Delete
break;
[623] Fix | Delete
default:
[624] Fix | Delete
$this->setError("Authentication method \"$authtype\" is not supported");
[625] Fix | Delete
[626] Fix | Delete
return false;
[627] Fix | Delete
}
[628] Fix | Delete
[629] Fix | Delete
return true;
[630] Fix | Delete
}
[631] Fix | Delete
[632] Fix | Delete
/**
[633] Fix | Delete
* Calculate an MD5 HMAC hash.
[634] Fix | Delete
* Works like hash_hmac('md5', $data, $key)
[635] Fix | Delete
* in case that function is not available.
[636] Fix | Delete
*
[637] Fix | Delete
* @param string $data The data to hash
[638] Fix | Delete
* @param string $key The key to hash with
[639] Fix | Delete
*
[640] Fix | Delete
* @return string
[641] Fix | Delete
*/
[642] Fix | Delete
protected function hmac($data, $key)
[643] Fix | Delete
{
[644] Fix | Delete
if (function_exists('hash_hmac')) {
[645] Fix | Delete
return hash_hmac('md5', $data, $key);
[646] Fix | Delete
}
[647] Fix | Delete
[648] Fix | Delete
//The following borrowed from
[649] Fix | Delete
//http://php.net/manual/en/function.mhash.php#27225
[650] Fix | Delete
[651] Fix | Delete
//RFC 2104 HMAC implementation for php.
[652] Fix | Delete
//Creates an md5 HMAC.
[653] Fix | Delete
//Eliminates the need to install mhash to compute a HMAC
[654] Fix | Delete
//by Lance Rushing
[655] Fix | Delete
[656] Fix | Delete
$bytelen = 64; //byte length for md5
[657] Fix | Delete
if (strlen($key) > $bytelen) {
[658] Fix | Delete
$key = pack('H*', md5($key));
[659] Fix | Delete
}
[660] Fix | Delete
$key = str_pad($key, $bytelen, chr(0x00));
[661] Fix | Delete
$ipad = str_pad('', $bytelen, chr(0x36));
[662] Fix | Delete
$opad = str_pad('', $bytelen, chr(0x5c));
[663] Fix | Delete
$k_ipad = $key ^ $ipad;
[664] Fix | Delete
$k_opad = $key ^ $opad;
[665] Fix | Delete
[666] Fix | Delete
return md5($k_opad . pack('H*', md5($k_ipad . $data)));
[667] Fix | Delete
}
[668] Fix | Delete
[669] Fix | Delete
/**
[670] Fix | Delete
* Check connection state.
[671] Fix | Delete
*
[672] Fix | Delete
* @return bool True if connected
[673] Fix | Delete
*/
[674] Fix | Delete
public function connected()
[675] Fix | Delete
{
[676] Fix | Delete
if (is_resource($this->smtp_conn)) {
[677] Fix | Delete
$sock_status = stream_get_meta_data($this->smtp_conn);
[678] Fix | Delete
if ($sock_status['eof']) {
[679] Fix | Delete
//The socket is valid but we are not connected
[680] Fix | Delete
$this->edebug(
[681] Fix | Delete
'SMTP NOTICE: EOF caught while checking if connected',
[682] Fix | Delete
self::DEBUG_CLIENT
[683] Fix | Delete
);
[684] Fix | Delete
$this->close();
[685] Fix | Delete
[686] Fix | Delete
return false;
[687] Fix | Delete
}
[688] Fix | Delete
[689] Fix | Delete
return true; //everything looks good
[690] Fix | Delete
}
[691] Fix | Delete
[692] Fix | Delete
return false;
[693] Fix | Delete
}
[694] Fix | Delete
[695] Fix | Delete
/**
[696] Fix | Delete
* Close the socket and clean up the state of the class.
[697] Fix | Delete
* Don't use this function without first trying to use QUIT.
[698] Fix | Delete
*
[699] Fix | Delete
* @see quit()
[700] Fix | Delete
*/
[701] Fix | Delete
public function close()
[702] Fix | Delete
{
[703] Fix | Delete
$this->server_caps = null;
[704] Fix | Delete
$this->helo_rply = null;
[705] Fix | Delete
if (is_resource($this->smtp_conn)) {
[706] Fix | Delete
//Close the connection and cleanup
[707] Fix | Delete
fclose($this->smtp_conn);
[708] Fix | Delete
$this->smtp_conn = null; //Makes for cleaner serialization
[709] Fix | Delete
$this->edebug('Connection: closed', self::DEBUG_CONNECTION);
[710] Fix | Delete
}
[711] Fix | Delete
}
[712] Fix | Delete
[713] Fix | Delete
/**
[714] Fix | Delete
* Send an SMTP DATA command.
[715] Fix | Delete
* Issues a data command and sends the msg_data to the server,
[716] Fix | Delete
* finalizing the mail transaction. $msg_data is the message
[717] Fix | Delete
* that is to be sent with the headers. Each header needs to be
[718] Fix | Delete
* on a single line followed by a <CRLF> with the message headers
[719] Fix | Delete
* and the message body being separated by an additional <CRLF>.
[720] Fix | Delete
* Implements RFC 821: DATA <CRLF>.
[721] Fix | Delete
*
[722] Fix | Delete
* @param string $msg_data Message data to send
[723] Fix | Delete
*
[724] Fix | Delete
* @return bool
[725] Fix | Delete
*/
[726] Fix | Delete
public function data($msg_data)
[727] Fix | Delete
{
[728] Fix | Delete
//This will use the standard timelimit
[729] Fix | Delete
if (!$this->sendCommand('DATA', 'DATA', 354)) {
[730] Fix | Delete
return false;
[731] Fix | Delete
}
[732] Fix | Delete
[733] Fix | Delete
/* The server is ready to accept data!
[734] Fix | Delete
* According to rfc821 we should not send more than 1000 characters on a single line (including the LE)
[735] Fix | Delete
* so we will break the data up into lines by \r and/or \n then if needed we will break each of those into
[736] Fix | Delete
* smaller lines to fit within the limit.
[737] Fix | Delete
* We will also look for lines that start with a '.' and prepend an additional '.'.
[738] Fix | Delete
* NOTE: this does not count towards line-length limit.
[739] Fix | Delete
*/
[740] Fix | Delete
[741] Fix | Delete
//Normalize line breaks before exploding
[742] Fix | Delete
$lines = explode("\n", str_replace(["\r\n", "\r"], "\n", $msg_data));
[743] Fix | Delete
[744] Fix | Delete
/* To distinguish between a complete RFC822 message and a plain message body, we check if the first field
[745] Fix | Delete
* of the first line (':' separated) does not contain a space then it _should_ be a header, and we will
[746] Fix | Delete
* process all lines before a blank line as headers.
[747] Fix | Delete
*/
[748] Fix | Delete
[749] Fix | Delete
$field = substr($lines[0], 0, strpos($lines[0], ':'));
[750] Fix | Delete
$in_headers = false;
[751] Fix | Delete
if (!empty($field) && strpos($field, ' ') === false) {
[752] Fix | Delete
$in_headers = true;
[753] Fix | Delete
}
[754] Fix | Delete
[755] Fix | Delete
foreach ($lines as $line) {
[756] Fix | Delete
$lines_out = [];
[757] Fix | Delete
if ($in_headers && $line === '') {
[758] Fix | Delete
$in_headers = false;
[759] Fix | Delete
}
[760] Fix | Delete
//Break this line up into several smaller lines if it's too long
[761] Fix | Delete
//Micro-optimisation: isset($str[$len]) is faster than (strlen($str) > $len),
[762] Fix | Delete
while (isset($line[self::MAX_LINE_LENGTH])) {
[763] Fix | Delete
//Working backwards, try to find a space within the last MAX_LINE_LENGTH chars of the line to break on
[764] Fix | Delete
//so as to avoid breaking in the middle of a word
[765] Fix | Delete
$pos = strrpos(substr($line, 0, self::MAX_LINE_LENGTH), ' ');
[766] Fix | Delete
//Deliberately matches both false and 0
[767] Fix | Delete
if (!$pos) {
[768] Fix | Delete
//No nice break found, add a hard break
[769] Fix | Delete
$pos = self::MAX_LINE_LENGTH - 1;
[770] Fix | Delete
$lines_out[] = substr($line, 0, $pos);
[771] Fix | Delete
$line = substr($line, $pos);
[772] Fix | Delete
} else {
[773] Fix | Delete
//Break at the found point
[774] Fix | Delete
$lines_out[] = substr($line, 0, $pos);
[775] Fix | Delete
//Move along by the amount we dealt with
[776] Fix | Delete
$line = substr($line, $pos + 1);
[777] Fix | Delete
}
[778] Fix | Delete
//If processing headers add a LWSP-char to the front of new line RFC822 section 3.1.1
[779] Fix | Delete
if ($in_headers) {
[780] Fix | Delete
$line = "\t" . $line;
[781] Fix | Delete
}
[782] Fix | Delete
}
[783] Fix | Delete
$lines_out[] = $line;
[784] Fix | Delete
[785] Fix | Delete
//Send the lines to the server
[786] Fix | Delete
foreach ($lines_out as $line_out) {
[787] Fix | Delete
//Dot-stuffing as per RFC5321 section 4.5.2
[788] Fix | Delete
//https://tools.ietf.org/html/rfc5321#section-4.5.2
[789] Fix | Delete
if (!empty($line_out) && $line_out[0] === '.') {
[790] Fix | Delete
$line_out = '.' . $line_out;
[791] Fix | Delete
}
[792] Fix | Delete
$this->client_send($line_out . static::LE, 'DATA');
[793] Fix | Delete
}
[794] Fix | Delete
}
[795] Fix | Delete
[796] Fix | Delete
//Message data has been sent, complete the command
[797] Fix | Delete
//Increase timelimit for end of DATA command
[798] Fix | Delete
$savetimelimit = $this->Timelimit;
[799] Fix | Delete
$this->Timelimit *= 2;
[800] Fix | Delete
$result = $this->sendCommand('DATA END', '.', 250);
[801] Fix | Delete
$this->recordLastTransactionID();
[802] Fix | Delete
//Restore timelimit
[803] Fix | Delete
$this->Timelimit = $savetimelimit;
[804] Fix | Delete
[805] Fix | Delete
return $result;
[806] Fix | Delete
}
[807] Fix | Delete
[808] Fix | Delete
/**
[809] Fix | Delete
* Send an SMTP HELO or EHLO command.
[810] Fix | Delete
* Used to identify the sending server to the receiving server.
[811] Fix | Delete
* This makes sure that client and server are in a known state.
[812] Fix | Delete
* Implements RFC 821: HELO <SP> <domain> <CRLF>
[813] Fix | Delete
* and RFC 2821 EHLO.
[814] Fix | Delete
*
[815] Fix | Delete
* @param string $host The host name or IP to connect to
[816] Fix | Delete
*
[817] Fix | Delete
* @return bool
[818] Fix | Delete
*/
[819] Fix | Delete
public function hello($host = '')
[820] Fix | Delete
{
[821] Fix | Delete
//Try extended hello first (RFC 2821)
[822] Fix | Delete
if ($this->sendHello('EHLO', $host)) {
[823] Fix | Delete
return true;
[824] Fix | Delete
}
[825] Fix | Delete
[826] Fix | Delete
//Some servers shut down the SMTP service here (RFC 5321)
[827] Fix | Delete
if (substr($this->helo_rply, 0, 3) == '421') {
[828] Fix | Delete
return false;
[829] Fix | Delete
}
[830] Fix | Delete
[831] Fix | Delete
return $this->sendHello('HELO', $host);
[832] Fix | Delete
}
[833] Fix | Delete
[834] Fix | Delete
/**
[835] Fix | Delete
* Send an SMTP HELO or EHLO command.
[836] Fix | Delete
* Low-level implementation used by hello().
[837] Fix | Delete
*
[838] Fix | Delete
* @param string $hello The HELO string
[839] Fix | Delete
* @param string $host The hostname to say we are
[840] Fix | Delete
*
[841] Fix | Delete
* @return bool
[842] Fix | Delete
*
[843] Fix | Delete
* @see hello()
[844] Fix | Delete
*/
[845] Fix | Delete
protected function sendHello($hello, $host)
[846] Fix | Delete
{
[847] Fix | Delete
$noerror = $this->sendCommand($hello, $hello . ' ' . $host, 250);
[848] Fix | Delete
$this->helo_rply = $this->last_reply;
[849] Fix | Delete
if ($noerror) {
[850] Fix | Delete
$this->parseHelloFields($hello);
[851] Fix | Delete
} else {
[852] Fix | Delete
$this->server_caps = null;
[853] Fix | Delete
}
[854] Fix | Delete
[855] Fix | Delete
return $noerror;
[856] Fix | Delete
}
[857] Fix | Delete
[858] Fix | Delete
/**
[859] Fix | Delete
* Parse a reply to HELO/EHLO command to discover server extensions.
[860] Fix | Delete
* In case of HELO, the only parameter that can be discovered is a server name.
[861] Fix | Delete
*
[862] Fix | Delete
* @param string $type `HELO` or `EHLO`
[863] Fix | Delete
*/
[864] Fix | Delete
protected function parseHelloFields($type)
[865] Fix | Delete
{
[866] Fix | Delete
$this->server_caps = [];
[867] Fix | Delete
$lines = explode("\n", $this->helo_rply);
[868] Fix | Delete
[869] Fix | Delete
foreach ($lines as $n => $s) {
[870] Fix | Delete
//First 4 chars contain response code followed by - or space
[871] Fix | Delete
$s = trim(substr($s, 4));
[872] Fix | Delete
if (empty($s)) {
[873] Fix | Delete
continue;
[874] Fix | Delete
}
[875] Fix | Delete
$fields = explode(' ', $s);
[876] Fix | Delete
if (!empty($fields)) {
[877] Fix | Delete
if (!$n) {
[878] Fix | Delete
$name = $type;
[879] Fix | Delete
$fields = $fields[0];
[880] Fix | Delete
} else {
[881] Fix | Delete
$name = array_shift($fields);
[882] Fix | Delete
switch ($name) {
[883] Fix | Delete
case 'SIZE':
[884] Fix | Delete
$fields = ($fields ? $fields[0] : 0);
[885] Fix | Delete
break;
[886] Fix | Delete
case 'AUTH':
[887] Fix | Delete
if (!is_array($fields)) {
[888] Fix | Delete
$fields = [];
[889] Fix | Delete
}
[890] Fix | Delete
break;
[891] Fix | Delete
default:
[892] Fix | Delete
$fields = true;
[893] Fix | Delete
}
[894] Fix | Delete
}
[895] Fix | Delete
$this->server_caps[$name] = $fields;
[896] Fix | Delete
}
[897] Fix | Delete
}
[898] Fix | Delete
}
[899] Fix | Delete
[900] Fix | Delete
/**
[901] Fix | Delete
* Send an SMTP MAIL command.
[902] Fix | Delete
* Starts a mail transaction from the email address specified in
[903] Fix | Delete
* $from. Returns true if successful or false otherwise. If True
[904] Fix | Delete
* the mail transaction is started and then one or more recipient
[905] Fix | Delete
* commands may be called followed by a data command.
[906] Fix | Delete
* Implements RFC 821: MAIL <SP> FROM:<reverse-path> <CRLF>.
[907] Fix | Delete
*
[908] Fix | Delete
* @param string $from Source address of this message
[909] Fix | Delete
*
[910] Fix | Delete
* @return bool
[911] Fix | Delete
*/
[912] Fix | Delete
public function mail($from)
[913] Fix | Delete
{
[914] Fix | Delete
$useVerp = ($this->do_verp ? ' XVERP' : '');
[915] Fix | Delete
[916] Fix | Delete
return $this->sendCommand(
[917] Fix | Delete
'MAIL FROM',
[918] Fix | Delete
'MAIL FROM:<' . $from . '>' . $useVerp,
[919] Fix | Delete
250
[920] Fix | Delete
);
[921] Fix | Delete
}
[922] Fix | Delete
[923] Fix | Delete
/**
[924] Fix | Delete
* Send an SMTP QUIT command.
[925] Fix | Delete
* Closes the socket if there is no error or the $close_on_error argument is true.
[926] Fix | Delete
* Implements from RFC 821: QUIT <CRLF>.
[927] Fix | Delete
*
[928] Fix | Delete
* @param bool $close_on_error Should the connection close if an error occurs?
[929] Fix | Delete
*
[930] Fix | Delete
* @return bool
[931] Fix | Delete
*/
[932] Fix | Delete
public function quit($close_on_error = true)
[933] Fix | Delete
{
[934] Fix | Delete
$noerror = $this->sendCommand('QUIT', 'QUIT', 221);
[935] Fix | Delete
$err = $this->error; //Save any error
[936] Fix | Delete
if ($noerror || $close_on_error) {
[937] Fix | Delete
$this->close();
[938] Fix | Delete
$this->error = $err; //Restore any error from the quit command
[939] Fix | Delete
}
[940] Fix | Delete
[941] Fix | Delete
return $noerror;
[942] Fix | Delete
}
[943] Fix | Delete
[944] Fix | Delete
/**
[945] Fix | Delete
* Send an SMTP RCPT command.
[946] Fix | Delete
* Sets the TO argument to $toaddr.
[947] Fix | Delete
* Returns true if the recipient was accepted false if it was rejected.
[948] Fix | Delete
* Implements from RFC 821: RCPT <SP> TO:<forward-path> <CRLF>.
[949] Fix | Delete
*
[950] Fix | Delete
* @param string $address The address the message is being sent to
[951] Fix | Delete
* @param string $dsn Comma separated list of DSN notifications. NEVER, SUCCESS, FAILURE
[952] Fix | Delete
* or DELAY. If you specify NEVER all other notifications are ignored.
[953] Fix | Delete
*
[954] Fix | Delete
* @return bool
[955] Fix | Delete
*/
[956] Fix | Delete
public function recipient($address, $dsn = '')
[957] Fix | Delete
{
[958] Fix | Delete
if (empty($dsn)) {
[959] Fix | Delete
$rcpt = 'RCPT TO:<' . $address . '>';
[960] Fix | Delete
} else {
[961] Fix | Delete
$dsn = strtoupper($dsn);
[962] Fix | Delete
$notify = [];
[963] Fix | Delete
[964] Fix | Delete
if (strpos($dsn, 'NEVER') !== false) {
[965] Fix | Delete
$notify[] = 'NEVER';
[966] Fix | Delete
} else {
[967] Fix | Delete
foreach (['SUCCESS', 'FAILURE', 'DELAY'] as $value) {
[968] Fix | Delete
if (strpos($dsn, $value) !== false) {
[969] Fix | Delete
$notify[] = $value;
[970] Fix | Delete
}
[971] Fix | Delete
}
[972] Fix | Delete
}
[973] Fix | Delete
[974] Fix | Delete
$rcpt = 'RCPT TO:<' . $address . '> NOTIFY=' . implode(',', $notify);
[975] Fix | Delete
}
[976] Fix | Delete
[977] Fix | Delete
return $this->sendCommand(
[978] Fix | Delete
'RCPT TO',
[979] Fix | Delete
$rcpt,
[980] Fix | Delete
[250, 251]
[981] Fix | Delete
);
[982] Fix | Delete
}
[983] Fix | Delete
[984] Fix | Delete
/**
[985] Fix | Delete
* Send SMTP XCLIENT command to server and check its return code.
[986] Fix | Delete
*
[987] Fix | Delete
* @return bool True on success
[988] Fix | Delete
*/
[989] Fix | Delete
public function xclient(array $vars)
[990] Fix | Delete
{
[991] Fix | Delete
$xclient_options = "";
[992] Fix | Delete
foreach ($vars as $key => $value) {
[993] Fix | Delete
if (in_array($key, SMTP::$xclient_allowed_attributes)) {
[994] Fix | Delete
$xclient_options .= " {$key}={$value}";
[995] Fix | Delete
}
[996] Fix | Delete
}
[997] Fix | Delete
if (!$xclient_options) {
[998] Fix | Delete
return true;
[999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function