PHPMailer\PHPMailer
SMTP::connected
Check connection state.
Method of the class: SMTP{}
No Hooks.
Returns
true|false. True if connected
Usage
$SMTP = new SMTP(); $SMTP->connected();
SMTP::connected() SMTP::connected code WP 7.0.2
public function connected()
{
if (is_resource($this->smtp_conn)) {
$sock_status = stream_get_meta_data($this->smtp_conn);
if ($sock_status['eof']) {
//The socket is valid but we are not connected
$this->edebug(
'SMTP NOTICE: EOF caught while checking if connected',
self::DEBUG_CLIENT
);
$this->close();
return false;
}
return true; //everything looks good
}
return false;
}