Heray-Was-Here
Server : Apache
System : Linux vps43555.mylogin.co 3.10.0-1160.53.1.vz7.185.3 #1 SMP Tue Jan 25 12:49:12 MSK 2022 x86_64
User : redsea ( 60651)
PHP Version : 7.4.32
Disable Function : NONE
Directory :  /usr/local/php5.4/lib/php/doc/Net_SMTP2/examples/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/local/php5.4/lib/php/doc/Net_SMTP2/examples/basic.php
<?php

require 'Net/SMTP2.php';

$host = 'mail.example.com';
$from = 'user@example.com';
$rcpt = array('recipient1@example.com', 'recipient2@example.com');
$subj = "Subject: Test Message\n";
$body = "Body Line 1\nBody Line 2";

/* Create a new Net_SMTP2 object. */
if (! ($smtp = new Net_SMTP2($host))) {
    die("Unable to instantiate Net_SMTP2 object\n");
}

/* Connect to the SMTP server. */
try {
    $smtp->connect();
} catch (PEAR_Exception $e) {
    die($e->getMessage() . "\n");
}
$smtp->auth('username','password');
/* Send the 'MAIL FROM:' SMTP command. */
try {
    $smtp->mailFrom($from);
} catch (PEAR_Exception $e) {
    die("Unable to set sender to <$from>\n");
}

/* Address the message to each of the recipients. */
try {
    foreach ($rcpt as $to) {
        $smtp->rcptTo($to);
    }
} catch (PEAR_Exception $e) {
    die("Unable to add recipient <$to>: " . $e->getMessage() . "\n");
}

/* Set the body of the message. */
try {
    $smtp->data($subj . "\r\n" . $body);
} catch (PEAR_Exception $e) {
    die("Unable to send data\n");
}

/* Disconnect from the SMTP server. */
$smtp->disconnect();

Hry