require_once __DIR__ . '/PHPMailer/Exception.php';
require_once __DIR__ . '/PHPMailer/PHPMailer.php';
require_once __DIR__ . '/PHPMailer/SMTP.php';
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
//и главная строчка: 
$phpmailer->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;  //Без которой письмо на 587й порт по tls не уходит.
//другие параметры:
$mail->SMTPDebug = SMTP::DEBUG_SERVER;
$mail->isSMTP();    
$mail->Mailer = 'tls';  
$mail->Host       = 'smtp.yandex.ru';
$mail->SMTPAuth   = true;
$mail->Username   = 'noreply@mydomain.ru';	
$mail->Password   = 'пароль от ящика noreply@mydomain.ru';
    
$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;
$mail->Port       = 587;require '../../vendor/autoload.php';
  use Sendpulse\RestApi\ApiClient;
  use Sendpulse\RestApi\Storage\FileStorage;
   define( 'API_USER_ID', $_GET['client-id'] );
   define( 'API_SECRET', $_GET['secret-id'] );
   define( 'TOKEN_STORAGE', 'file' );
   $SPApiProxy = new ApiClient( API_USER_ID, API_SECRET, new FileStorage() );
$emails = array(
            array(
              'email' => $_GET['email'],
              'variables' => array(
                  'Phone' => $_GET['phone'],
                  'Name' => $_GET['name'],
                )
                ),
             );
$bookID = $_GET['bookID'];
$result = $SPApiProxy->addEmails($bookID,$emails);
$json_result = json_encode($result);
$json_beautified = str_replace(array("{", "}", ","), array("{<br />    ", "<br />}", ",<br />    "), $json_result);
print_r($json_beautified);      require '../../vendor/autoload.php';
  use Sendpulse\RestApi\ApiClient;
  use Sendpulse\RestApi\Storage\FileStorage;
   define( 'API_USER_ID', $_GET['client-id'] );
   define( 'API_SECRET', $_GET['secret-id'] );
   define( 'TOKEN_STORAGE', 'file' );
   $SPApiProxy = new ApiClient( API_USER_ID, API_SECRET, new FileStorage() );
$emails = array(
            array(
              'email' => $_GET['email'],
              'variables' => array(
                  'Phone' => $_GET['phone'],
                  'Name' => $_GET['name'],
                )
                ),
             );
$bookID = $_GET['bookID'];
$result = $SPApiProxy->addEmails($bookID,$emails);
$json_result = json_encode($result);
$json_beautified = str_replace(array("{", "}", ","), array("{<br />    ", "<br />}", ",<br />    "), $json_result);
print_r($json_beautified);      function file_get_contents_curl( $url ) {
  $ch = curl_init();
  curl_setopt( $ch, CURLOPT_AUTOREFERER, TRUE );
  curl_setopt( $ch, CURLOPT_HEADER, 0 );
  curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
  curl_setopt( $ch, CURLOPT_URL, $url );
  curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, TRUE );
  $data = curl_exec( $ch );
  curl_close( $ch );
  return $data;
}