cyberfusion/proxmox-mail-gateway

2.0 2023-09-15 12:53 UTC

This package is auto-updated.

Last update: 2024-09-21 09:52:39 UTC


README

Proxmox Mail Gateway 的库。

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

安装

Composer

运行以下命令从 Packagist 安装此包

composer require cyberfusion/proxmox-mail-gateway

用法

示例

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