Documentation

Smtp

Smtp class handles mail via SMTP.

Class methods

MethodDescription Available from version
__constructSMTP client constructor.
__destructDestructor, closes connection when destroying an object.
connectEstablishes connection via SMTP.
authenticateAuthenticates at SMTP server.
getErrorsReturns all SMTP client errors.

Example


// Creates class instance and calls its methods

$client = new Mail\Smtp(
            $this->host,
            $this->port,
            ('smtps' === $this->protocol || ('smtp' !== $this->protocol && 465 === $this->port)),
            true,
            $this->login,
            $this->password
        );

        if (!$client->authenticate($error))
        {
            $errors = $client->getErrors();
            return false;
        }


© «Bitrix24», 2001-2024