PHP code example of reloop / reloop-email

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

    

reloop / reloop-email example snippets




eloop\Exceptions\ReloopApiException;
use Reloop\Exceptions\ReloopValidationException;
use Reloop\Reloop;

$reloop = Reloop::client('rl_your_api_key_here');

try {
    $result = $reloop->mail->send([
        'from' => 'Reloop <[email protected]>',
        'to' => '[email protected]',
        'subject' => 'Welcome to Reloop',
        'html' => '<p>Thanks for signing up.</p>',
        'text' => 'Thanks for signing up.',
    ]);
    echo $result['messageId'] . ' ' . $result['id'] . PHP_EOL;
} catch (ReloopValidationException $e) {
    fwrite(STDERR, 'invalid request (' . $e->field . '): ' . $e->getMessage() . PHP_EOL);
} catch (ReloopApiException $e) {
    fwrite(STDERR, 'API error ' . $e->status . ': ' . $e->getMessage() . PHP_EOL);
}

$reloop->apiKey;    // create, list, get, update, delete, rotate, enable, disable
$reloop->mail;      // send
$reloop->domain;    // create, list, get, update, delete, verify
$reloop->contacts;  // CRUD + ->properties, ->groups, ->channels
$reloop->webhook;   // CRUD, pause/enable/disable, trigger, deliveries + verify
$reloop->inbox;     // ->mailboxes, ->messages, ->threads

use Reloop\Services\WebhookVerify;

$event = WebhookVerify::constructEvent($payload, $signature, $secret, 300);
// or $reloop->webhook->verify([...])