e-monsite / mailcow-php-client
Requires
- php: >=5.5
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^6.2
Requires (Dev)
- friendsofphp/php-cs-fixer: ~1.12
- phpunit/phpunit: ^4.8
- squizlabs/php_codesniffer: ~2.6
This package is auto-updated.
Last update: 2025-03-29 01:04:12 UTC
README
mailcow is complete e-mailing solution with advanced antispam, antivirus, nice UI and API. In order to use this API you have to create a API key and add your IP address to the whitelist of allowed IPs this can be done by logging into the Mailcow UI using your admin account, then go to Configuration > Access > Edit administrator details > API. There you will find a collapsed API menu. There are two types of API keys - The read only key can only be used for all get endpoints - The read write key can be used for all endpoints
This PHP package is automatically generated by the Swagger Codegen project:
- API version: 1.0.0
- Build package: io.swagger.codegen.v3.generators.php.PhpClientCodegen
Requirements
PHP 5.5 and later
Installation & Usage
Composer
To install the bindings via Composer, add the following to composer.json
:
{
"repositories": [
{
"type": "git",
"url": "https://github.com//e-monsite/mailcow-php-client.git"
}
],
"require": {
"e-monsite/mailcow-php-client": "*@dev"
}
}
Then run composer install
Manual Installation
Download the files and include autoload.php
:
require_once('/path/to/SwaggerClient-php/vendor/autoload.php');
Tests
To run the unit tests:
composer install
./vendor/bin/phpunit
Getting Started
Please follow the installation procedure and then run the following:
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: ApiKeyAuth $config = MailCow\Configuration::getDefaultConfiguration()->setApiKey('X-API-Key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = MailCow\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-API-Key', 'Bearer'); $apiInstance = new MailCow\Api\AddressRewritingApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $body = new \MailCow\Models\AddBccBody(); // \MailCow\Models\AddBccBody | try { $result = $apiInstance->createBCCMap($body); print_r($result); } catch (Exception $e) { echo 'Exception when calling AddressRewritingApi->createBCCMap: ', $e->getMessage(), PHP_EOL; } // Configure API key authorization: ApiKeyAuth $config = MailCow\Configuration::getDefaultConfiguration()->setApiKey('X-API-Key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = MailCow\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-API-Key', 'Bearer'); $apiInstance = new MailCow\Api\AddressRewritingApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $body = new \MailCow\Models\AddRecipientMapBody(); // \MailCow\Models\AddRecipientMapBody | try { $result = $apiInstance->createRecipientMap($body); print_r($result); } catch (Exception $e) { echo 'Exception when calling AddressRewritingApi->createRecipientMap: ', $e->getMessage(), PHP_EOL; } // Configure API key authorization: ApiKeyAuth $config = MailCow\Configuration::getDefaultConfiguration()->setApiKey('X-API-Key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = MailCow\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-API-Key', 'Bearer'); $apiInstance = new MailCow\Api\AddressRewritingApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $body = new \MailCow\Models\DeleteBccBody(); // \MailCow\Models\DeleteBccBody | try { $result = $apiInstance->deleteBCCMap($body); print_r($result); } catch (Exception $e) { echo 'Exception when calling AddressRewritingApi->deleteBCCMap: ', $e->getMessage(), PHP_EOL; } // Configure API key authorization: ApiKeyAuth $config = MailCow\Configuration::getDefaultConfiguration()->setApiKey('X-API-Key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = MailCow\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-API-Key', 'Bearer'); $apiInstance = new MailCow\Api\AddressRewritingApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $body = new \MailCow\Models\DeleteRecipientMapBody(); // \MailCow\Models\DeleteRecipientMapBody | try { $result = $apiInstance->deleteRecipientMap($body); print_r($result); } catch (Exception $e) { echo 'Exception when calling AddressRewritingApi->deleteRecipientMap: ', $e->getMessage(), PHP_EOL; } // Configure API key authorization: ApiKeyAuth $config = MailCow\Configuration::getDefaultConfiguration()->setApiKey('X-API-Key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = MailCow\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-API-Key', 'Bearer'); $apiInstance = new MailCow\Api\AddressRewritingApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $id = "id_example"; // string | id of entry you want to get $x_api_key = "x_api_key_example"; // string | e.g. api-key-string try { $apiInstance->getBCCMap($id, $x_api_key); } catch (Exception $e) { echo 'Exception when calling AddressRewritingApi->getBCCMap: ', $e->getMessage(), PHP_EOL; } // Configure API key authorization: ApiKeyAuth $config = MailCow\Configuration::getDefaultConfiguration()->setApiKey('X-API-Key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = MailCow\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-API-Key', 'Bearer'); $apiInstance = new MailCow\Api\AddressRewritingApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $id = "id_example"; // string | id of entry you want to get $x_api_key = "x_api_key_example"; // string | e.g. api-key-string try { $apiInstance->getRecipientMap($id, $x_api_key); } catch (Exception $e) { echo 'Exception when calling AddressRewritingApi->getRecipientMap: ', $e->getMessage(), PHP_EOL; } ?>
Documentation for API Endpoints
All URIs are relative to https://raw.githubusercontent.com/
Class | Method | HTTP request | Description |
---|---|---|---|
AddressRewritingApi | createBCCMap | POST /api/v1/add/bcc | Create BCC Map |
AddressRewritingApi | createRecipientMap | POST /api/v1/add/recipient_map | Create Recipient Map |
AddressRewritingApi | deleteBCCMap | POST /api/v1/delete/bcc | Delete BCC Map |
AddressRewritingApi | deleteRecipientMap | POST /api/v1/delete/recipient_map | Delete Recipient Map |
AddressRewritingApi | getBCCMap | GET /api/v1/get/bcc/{id} | Get BCC Map |
AddressRewritingApi | getRecipientMap | GET /api/v1/get/recipient_map/{id} | Get Recipient Map |
AliasesApi | createAlias | POST /api/v1/add/alias | Create alias |
AliasesApi | createTimeLimitedAlias | POST /api/v1/add/time_limited_alias | Create time limited alias |
AliasesApi | deleteAlias | POST /api/v1/delete/alias | Delete alias |
AliasesApi | getAliases | GET /api/v1/get/alias/{id} | Get aliases |
AliasesApi | getTimeLimitedAliases | GET /api/v1/get/time_limited_aliases/{mailbox} | Get time limited aliases |
AliasesApi | updateAlias | POST /api/v1/edit/alias | Update alias |
AppPasswordsApi | createAppPassword | POST /api/v1/add/app-passwd | Create App Password |
AppPasswordsApi | deleteAppPassword | POST /api/v1/delete/app-passwd | Delete App Password |
AppPasswordsApi | getAppPassword | GET /api/v1/get/app-passwd/all/{mailbox} | Get App Password |
DKIMApi | deleteDKIMKey | POST /api/v1/delete/dkim | Delete DKIM Key |
DKIMApi | duplicateDKIMKey | POST /api/v1/add/dkim_duplicate | Duplicate DKIM Key |
DKIMApi | generateDKIMKey | POST /api/v1/add/dkim | Generate DKIM Key |
DKIMApi | getDKIMKey | GET /api/v1/get/dkim/{domain} | Get DKIM Key |
DomainAdminApi | createDomainAdminUser | POST /api/v1/add/domain-admin | Create Domain Admin user |
DomainAdminApi | deleteDomainAdmin | POST /api/v1/delete/domain-admin | Delete Domain Admin |
DomainAdminApi | editDomainAdminACL | POST /api/v1/edit/da-acl | Edit Domain Admin ACL |
DomainAdminApi | editDomainAdminUser | POST /api/v1/edit/domain-admin | Edit Domain Admin user |
DomainAdminApi | getDomainAdmins | GET /api/v1/get/domain-admin/all | Get Domain Admins |
DomainAntispamPoliciesApi | createDomainPolicy | POST /api/v1/add/domain-policy | Create domain policy |
DomainAntispamPoliciesApi | deleteDomainPolicy | POST /api/v1/delete/domain-policy | Delete domain policy |
DomainAntispamPoliciesApi | listBlacklistDomainPolicy | GET /api/v1/get/policy_bl_domain/{domain} | List blacklist domain policy |
DomainAntispamPoliciesApi | listWhitelistDomainPolicy | GET /api/v1/get/policy_wl_domain/{domain} | List whitelist domain policy |
DomainsApi | createDomain | POST /api/v1/add/domain | Create domain |
DomainsApi | deleteDomain | POST /api/v1/delete/domain | Delete domain |
DomainsApi | deleteDomainTags | POST /api/v1/delete/domain/tag/{domain} | Delete domain tags |
DomainsApi | getDomains | GET /api/v1/get/domain/{id} | Get domains |
DomainsApi | updateDomain | POST /api/v1/edit/domain | Update domain |
Fail2BanApi | editFail2Ban | POST /api/v1/edit/fail2ban | Edit Fail2Ban |
Fail2BanApi | getFail2BanConfig | GET /api/v1/get/fail2ban | Get Fail2Ban Config |
FordwardingHostsApi | addForwardHost | POST /api/v1/add/fwdhost | Add Forward Host |
FordwardingHostsApi | deleteForwardHost | POST /api/v1/delete/fwdhost | Delete Forward Host |
FordwardingHostsApi | getForwardingHosts | GET /api/v1/get/fwdhost/all | Get Forwarding Hosts |
LogsApi | getACMELogs | GET /api/v1/get/logs/acme/{count} | Get ACME logs |
LogsApi | getApiLogs | GET /api/v1/get/logs/api/{count} | Get Api logs |
LogsApi | getAutodiscoverLogs | GET /api/v1/get/logs/autodiscover/{count} | Get Autodiscover logs |
LogsApi | getDovecotLogs | GET /api/v1/get/logs/dovecot/{count} | Get Dovecot logs |
LogsApi | getNetfilterLogs | GET /api/v1/get/logs/netfilter/{count} | Get Netfilter logs |
LogsApi | getPostfixLogs | GET /api/v1/get/logs/postfix/{count} | Get Postfix logs |
LogsApi | getRatelimitLogs | GET /api/v1/get/logs/ratelimited/{count} | Get Ratelimit logs |
LogsApi | getRspamdLogs | GET /api/v1/get/logs/rspamd-history/{count} | Get Rspamd logs |
LogsApi | getSOGoLogs | GET /api/v1/get/logs/sogo/{count} | Get SOGo logs |
LogsApi | getWatchdogLogs | GET /api/v1/get/logs/watchdog/{count} | Get Watchdog logs |
MailboxesApi | createMailbox | POST /api/v1/add/mailbox | Create mailbox |
MailboxesApi | deleteMailbox | POST /api/v1/delete/mailbox | Delete mailbox |
MailboxesApi | deleteMailboxTags | POST /api/v1/delete/mailbox/tag/{mailbox} | Delete mailbox tags |
MailboxesApi | editMailboxSpamFilterScore | POST /api/v1/edit/spam-score/ | Edit mailbox spam filter score |
MailboxesApi | getMailboxes | GET /api/v1/get/mailbox/{id} | Get mailboxes |
MailboxesApi | quarantineNotifications | POST /api/v1/edit/quarantine_notification | Quarantine Notifications |
MailboxesApi | updateMailbox | POST /api/v1/edit/mailbox | Update mailbox |
MailboxesApi | updateMailboxACL | POST /api/v1/edit/user-acl | Update mailbox ACL |
MailboxesApi | updatePushoverSettings | POST /api/v1/edit/pushover | Update Pushover settings |
OAuthClientsApi | createOAuthClient | POST /api/v1/add/oauth2-client | Create oAuth Client |
OAuthClientsApi | deleteOAuthClient | POST /api/v1/delete/oauth2-client | Delete oAuth Client |
OAuthClientsApi | getOAuthClients | GET /api/v1/get/oauth2-client/{id} | Get oAuth Clients |
OutgoingTLSPolicyMapOverridesApi | createTLSPolicyMap | POST /api/v1/add/tls-policy-map | Create TLS Policy Map |
OutgoingTLSPolicyMapOverridesApi | deleteTLSPolicyMap | POST /api/v1/delete/tls-policy-map | Delete TLS Policy Map |
OutgoingTLSPolicyMapOverridesApi | getTLSPolicyMap | GET /api/v1/get/tls-policy-map/{id} | Get TLS Policy Map |
QuarantineApi | deleteMailsInQuarantine | POST /api/v1/delete/qitem | Delete mails in Quarantine |
QuarantineApi | getMailsInQuarantine | GET /api/v1/get/quarantine/all | Get mails in Quarantine |
QueueManagerApi | deleteQueue | POST /api/v1/delete/mailq | Delete Queue |
QueueManagerApi | flushQueue | POST /api/v1/edit/mailq | Flush Queue |
QueueManagerApi | getQueue | GET /api/v1/get/mailq/all | Get Queue |
RatelimitsApi | editDomainRatelimits | POST /api/v1/edit/rl-domain/ | Edit domain ratelimits |
RatelimitsApi | editMailboxRatelimits | POST /api/v1/edit/rl-mbox/ | Edit mailbox ratelimits |
RatelimitsApi | getDomainRatelimits | GET /api/v1/get/rl-domain/{domain} | Get domain ratelimits |
RatelimitsApi | getMailboxRatelimits | GET /api/v1/get/rl-mbox/{mailbox} | Get mailbox ratelimits |
ResourcesApi | createResources | POST /api/v1/add/resource | Create Resources |
ResourcesApi | deleteResources | POST /api/v1/delete/resource | Delete Resources |
ResourcesApi | getResources | GET /api/v1/get/resource/all | Get Resources |
RoutingApi | createSenderDependentTransports | POST /api/v1/add/relayhost | Create Sender-Dependent Transports |
RoutingApi | createTransportMaps | POST /api/v1/add/transport | Create Transport Maps |
RoutingApi | deleteSenderDependentTransports | POST /api/v1/delete/relayhost | Delete Sender-Dependent Transports |
RoutingApi | deleteTransportMaps | POST /api/v1/delete/transport | Delete Transport Maps |
RoutingApi | getSenderDependentTransports | GET /api/v1/get/relayhost/{id} | Get Sender-Dependent Transports |
RoutingApi | getTransportMaps | GET /api/v1/get/transport/{id} | Get Transport Maps |
StatusApi | getContainerStatus | GET /api/v1/get/status/containers | Get container status |
StatusApi | getSolrStatus | GET /api/v1/get/status/solr | Get solr status |
StatusApi | getVersionStatus | GET /api/v1/get/status/version | Get version status |
StatusApi | getVmailStatus | GET /api/v1/get/status/vmail | Get vmail status |
SyncJobsApi | createSyncJob | POST /api/v1/add/syncjob | Create sync job |
SyncJobsApi | deleteSyncJob | POST /api/v1/delete/syncjob | Delete sync job |
SyncJobsApi | getSyncJobs | GET /api/v1/get/syncjobs/all/no_log | Get sync jobs |
SyncJobsApi | updateSyncJob | POST /api/v1/edit/syncjob | Update sync job |
Documentation For Models
- AddAliasBody
- AddApppasswdBody
- AddBccBody
- AddDkimBody
- AddDkimDuplicateBody
- AddDomainBody
- AddDomainadminBody
- AddDomainpolicyBody
- AddFwdhostBody
- AddMailboxBody
- AddOauth2clientBody
- AddRecipientMapBody
- AddRelayhostBody
- AddResourceBody
- AddSyncjobBody
- AddTimeLimitedAliasBody
- AddTlspolicymapBody
- AddTransportBody
- Apiv1editaliasAttr
- Apiv1editdaaclAttr
- Apiv1editdomainAttr
- Apiv1editdomainadminAttr
- Apiv1editfail2banAttr
- Apiv1editmailboxAttr
- Apiv1editpushoverAttr
- Apiv1editquarantineNotificationAttr
- Apiv1editrlmboxAttr
- Apiv1editsyncjobAttr
- Apiv1edituseraclAttr
- DeleteApppasswdBody
- DeleteBccBody
- DeleteDomainBody
- DeleteDomainadminBody
- DeleteDomainpolicyBody
- DeleteFwdhostBody
- DeleteMailboxBody
- DeleteMailqBody
- DeleteOauth2clientBody
- DeleteQitemBody
- DeleteRecipientMapBody
- DeleteRelayhostBody
- DeleteResourceBody
- DeleteSyncjobBody
- DeleteTlspolicymapBody
- DeleteTransportBody
- EditAliasBody
- EditDaaclBody
- EditDomainBody
- EditDomainadminBody
- EditFail2banBody
- EditMailboxBody
- EditMailqBody
- EditPushoverBody
- EditQuarantineNotificationBody
- EditRldomainBody
- EditRlmboxBody
- EditSyncjobBody
- EditUseraclBody
- InlineResponse200
- InlineResponse2001
- InlineResponse401
- TagDomainBody
- TagMailboxBody
Documentation For Authorization
ApiKeyAuth
- Type: API key
- API key parameter name: X-API-Key
- Location: HTTP header