PHPMailer\PHPMailer
SMTP::recipient
Send an SMTP RCPT command. Sets the TO argument to $toaddr. Returns true if the recipient was accepted false if it was rejected. Implements from RFC 821: RCPT <SP> TO:<forward-path> <CRLF>.
Method of the class: SMTP{}
No Hooks.
Returns
true|false.
Usage
$SMTP = new SMTP(); $SMTP->recipient( $address, $dsn );
- $address(string) (required)
- The address the message is being sent to.
- $dsn(string)
- Comma separated list of DSN notifications. NEVER, SUCCESS, FAILURE or DELAY. If you specify NEVER all other notifications are ignored.
Default:''
SMTP::recipient() SMTP::recipient code WP 7.0
public function recipient($address, $dsn = '')
{
if (empty($dsn)) {
$rcpt = 'RCPT TO:<' . $address . '>';
} else {
$dsn = strtoupper($dsn);
$notify = [];
if (strpos($dsn, 'NEVER') !== false) {
$notify[] = 'NEVER';
} else {
foreach (['SUCCESS', 'FAILURE', 'DELAY'] as $value) {
if (strpos($dsn, $value) !== false) {
$notify[] = $value;
}
}
}
$rcpt = 'RCPT TO:<' . $address . '> NOTIFY=' . implode(',', $notify);
}
return $this->sendCommand(
'RCPT TO',
$rcpt,
[250, 251]
);
}