PHP code example of smartsender / smartsender-php

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

    

smartsender / smartsender-php example snippets


$accessToken = new \SmartSender\V3\Auth\AccessToken('putYourAccessTokenHere');
$adapter = new \SmartSender\V3\Adapter\CurlAdapter($accessToken);

$mailer = new \SmartSender\V3\Client\Mailer($adapter);
        
try {
    
    // Almost all declared methods can throw an Exception, so you can catch it
    
    $email = new \SmartSender\V3\Email\Email();
        // Set parameters of Email
        // ...
                    
    $email = $mailer->sendEmail($email);
    echo $email->getId();
    
} catch(\SmartSender\V3\Exceptions\SmartSenderException $e) {
    echo $e->getMessage();
}
$xslt
composer