cyberfusion/proxmox-mail-gateway

2.0 2023-09-15 12:53 UTC

This package is auto-updated.

Last update: 2024-10-21 09:57:33 UTC


README

Library for Proxmox Mail Gateway.

Proxmox Mail Gateway API documentation: https://pmg.proxmox.com/pmg-docs/api-viewer/index.html

Install

Composer

Run the following command to install the package from Packagist:

composer require cyberfusion/proxmox-mail-gateway

Usage

Example

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