PHP code example of alfredo-ramos / mailrelay-api-client

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

    

alfredo-ramos / mailrelay-api-client example snippets




$mailrelay = new AlfredoRamos\Mailrelay\Client([
	'api_account' => 'mailrelay_account',
	'api_token' => 'mailrelay_api_token'
]);

// Create or update a subscriber
$mailrelay->api('subscribers')->sync([
	'status' => 'active',
	'email' => '[email protected]',
	'group_ids' => [1]
]);

// Get account package info
$mailrelay->api('package')->info();

$result = $this->client->withOptions(['full_response' => true])->api('subscribers')->list([
	'page' => 1, 'per_page' => 10
]);
$subscribers = $result->toArray();
$total = $result->totalPages();
$perPage = $result->perPage();