PHP code example of cyberfusion / proxmox-mail-gateway

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

    

cyberfusion / proxmox-mail-gateway example snippets


use Cyberfusion\ProxmoxMGW\Client;
use Cyberfusion\ProxmoxMGW\Endpoints\Config\DkimEndpoint;
use Cyberfusion\ProxmoxMGW\Exceptions\AuthenticationException;
use Cyberfusion\ProxmoxMGW\Models\DkimDomainData;
use Cyberfusion\ProxmoxMGW\Requests\DkimGetRequest;

try {
    $client = new Client('pmgtest.cyberfusion.nl');
    $client->authenticate('apiuser', 'Super secret password.');
} catch (AuthenticationException $e) {
    // Handle authentication error
}

$dkimEndpoint = new DkimEndpoint($client);
$result = $dkimEndpoint->get(new DkimGetRequest('example.com'));
if ($result->failed()) {
    // Handle error
}

/** @var DkimDomainData $dkim */
$dkim = $result->getData('dkim');
// $dkim->domain -> example.com