PHP code example of codexsoft / unisender-one-api-php-client

1. Go to this page and download the library: Download codexsoft/unisender-one-api-php-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/ */

    

codexsoft / unisender-one-api-php-client example snippets




$client = new \CodexSoft\UnisenderOneApiSdk\Client('YOUR_USERNAME', '<YOUR_API_KEY>');
$balance = $client->getBalance();

$client->sendEmail([
    'body' => [
        'html' => '<h1>Hello world</h1>',
        'plaintext' => 'Hello world',
    ],
    'subject' => 'Example subject',
    'from_email' => '[email protected]',
    'from_name' => 'John Doe',
    'reply_to' => '[email protected]',
    'track_links' => 1,
    'track_read' => 1,
    'headers' => [
        'X-ReplyTo' => '[email protected]',
    ],
    'recipients' => [
        [
            'email' => '[email protected]',
            'substitutions' => [],
            'metadata' => [],
        ]
    ],
    'metadata' => [],
    'attachments' => [],
    'inline_attachments' => [],
    'options' => [],
]);