PHP code example of siteworx / mail-client

1. Go to this page and download the library: Download siteworx/mail-client 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/ */

    

siteworx / mail-client example snippets




$transport = new Siteworx\Mail\Transports\ApiTransport([
	'client_id' => 'k4ndk...4kkfa',
	'client_secret' => 'Jdv4...4kvD'
]);

$client = new Siteworx\Mail\Client($transport);

$client->setSubject('Test Subject');
$client->setFrom('[email protected]');

$client->addTo('[email protected]');
$client->addTo('[email protected]');

$client->setBody('Test Message!');

$result = $client->send();


$memcache = new Memcache;
$memcache->addServer($host);

$transport = new Siteworx\Mail\Transports\ApiTransport([
	'client_id' => 'k4ndk...4kkfa',
	'client_secret' => 'Jdv4...4kvD'
]);

$transport->setCache($memcache);

$client->send(true);

$time = new DateTime();
$time->add(new DateInterval('P1D'));
$client->sendTime($time);