PHP code example of duta / duta-php
1. Go to this page and download the library: Download duta/duta-php 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/ */
duta / duta-php example snippets
$duta = new \Duta\Client('duta_live_xxx');
$result = $duta->emails->send([
'from' => '[email protected]',
'to' => '[email protected]',
'subject' => 'Welcome to Duta',
'html' => '<p>Thanks for signing up!</p>',
]);
echo "Sent: " . $result['id'];
use Duta\DutaException;
try {
$duta->emails->send([ /* ... */ ]);
} catch (DutaException $e) {
echo $e->statusCode . ' ' . $e->name . ': ' . $e->getMessage();
// $e->name: authentication_error | permission_denied | rate_limit_exceeded | ...
}
bash
composer