PHP code example of unimails / unimail-php-sdk
1. Go to this page and download the library: Download unimails/unimail-php-sdk library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
unimails / unimail-php-sdk example snippets
nimails\UnimailPhpSdk\Client;
use Unimails\UnimailPhpSdk\UnimailReq;
$client = new Client('YOUR_UNIMAIL_KEY');
$client->setLanguage('en');
// test client connection;
$client->checkConnect();
// send email
$req = new UnimailReq();
$req->route = 'route';
$req->from = 'unimail';
$req->receivers = ['[email protected]'];
$req->subject = 'test';
$req->txtContent = "text content";
$req->htmlContent = '<h1>Hello</h1>';
$req->appendFile('attachment.txt', __DIR__ . '/tests/attachment.txt');
$result = $client->sendEmail($req);
echo $result->toJson() . PHP_EOL;
bash
composer