From ac6558f7391fb11227c507e96e5f7a0a71d24a3b Mon Sep 17 00:00:00 2001 From: Ente Date: Sat, 26 Sep 2026 20:22:46 +0200 Subject: [PATCH] Align with version 2026-09 --- src/AddressRewrite/AddressRewrite.php | 8 ++++---- src/DKIM/DKIM.php | 2 +- src/DomainAdmin/DomainAdmin.php | 10 +++++----- src/Domains/Domains.php | 4 +++- src/Fail2Ban/Fail2Ban.php | 8 +++++++- src/Quarantine/Quarantine.php | 15 +++++++++++++++ src/QueueManager/QueueManager.php | 4 ++-- src/Ratelimits/Ratelimits.php | 5 +++-- src/Resources/Resources.php | 2 +- src/Routing/Routing.php | 10 +++++----- src/Status/Status.php | 1 + src/SyncJobs/SyncJobs.php | 10 ++++++++++ src/oAuth/oAuth.php | 6 +++--- 13 files changed, 60 insertions(+), 25 deletions(-) diff --git a/src/AddressRewrite/AddressRewrite.php b/src/AddressRewrite/AddressRewrite.php index 63acbdf..ed5edf2 100644 --- a/src/AddressRewrite/AddressRewrite.php +++ b/src/AddressRewrite/AddressRewrite.php @@ -60,19 +60,19 @@ public function deleteRecipientMap(int $id){ /** * `getBccMap()` - Returns the configuration of a BCC mapping - * @param int $id The ID of the mapping + * @param int|string $id The ID of the mapping or "all" to get all mappings * @return array */ - public function getBccMap(int $id){ + public function getBccMap(int|string $id){ return $this->MailCowAPI->get('get/bcc/' . $id); } /** * `getRecipientMap()` - Returns the configuration of a Recipient mapping - * @param int $id The ID of the mapping + * @param int|string $id The ID of the mapping or "all" to get all mappings * @return array */ - public function getRecipientMap(int $id){ + public function getRecipientMap(int|string $id){ return $this->MailCowAPI->get('get/recipient_map/' . $id); } diff --git a/src/DKIM/DKIM.php b/src/DKIM/DKIM.php index eda5f72..79872b6 100644 --- a/src/DKIM/DKIM.php +++ b/src/DKIM/DKIM.php @@ -16,7 +16,7 @@ public function __construct(MailCowAPI $MailCowAPI){ * @return array */ public function deleteKey(string $domain){ - return $this->MailCowAPI->post('delete/dkim', [$domain]); + return $this->MailCowAPI->post('delete/dkim', [[$domain]]); } /** diff --git a/src/DomainAdmin/DomainAdmin.php b/src/DomainAdmin/DomainAdmin.php index 2d6d1c3..6ea74b5 100644 --- a/src/DomainAdmin/DomainAdmin.php +++ b/src/DomainAdmin/DomainAdmin.php @@ -34,7 +34,7 @@ public function __construct(MailCowAPI $MailCowAPI) /** * addAdmin - Add an domain admin * @param array $domains Array of domains the user should be domain admin of - * @param string $password + * @param string $password Password for the domain admin * @param string $password2 Same password, just again * @param string $username User which gets to be the domain admin * @return array @@ -52,15 +52,15 @@ public function addAdmin(array $domains, string $password, string $password2, st /** * editDomainAdminACL - Edit the ACLs for Domain Admins - * @param string $acl - The ACL in question to edit + * @param array $acl_users - The ACL in question to edit * @param array $permissions - An array of permissions. See $this->permissions, e.g. ["smtp_ip_access", "domain_desc", "alias_domain", ...] * @return array */ - public function editDomainAdminACL(string $acl, array $permissions) + public function editDomainAdminACL(array $acl_users, array $permissions) { return $this->MailCowAPI->post('edit/da-acl', [ - "items" => $acl, - "attr" => $this->computePermissions($permissions) + "items" => $acl_users, + "attr" => ["da_acl" => $this->computePermissions($permissions)] ]); } diff --git a/src/Domains/Domains.php b/src/Domains/Domains.php index 4c3b2fb..912dc08 100644 --- a/src/Domains/Domains.php +++ b/src/Domains/Domains.php @@ -181,6 +181,8 @@ public function updateFooter(string $domain, string $html, string $plain, ?array * */ public function deleteDomainTag(string $domain, array $tags){ - return $this->MailCowAPI->post('delete/domain/tag/' . urlencode($domain), $tags); + return $this->MailCowAPI->post('delete/domain/tag/' . urlencode($domain), + $tags + ); } } \ No newline at end of file diff --git a/src/Fail2Ban/Fail2Ban.php b/src/Fail2Ban/Fail2Ban.php index a26a4d5..7223220 100644 --- a/src/Fail2Ban/Fail2Ban.php +++ b/src/Fail2Ban/Fail2Ban.php @@ -13,14 +13,20 @@ public function __construct(MailCowAPI $MailCowAPI){ /** * editConfig - Edit Fail2Ban config * @param int $bantimeInMs Time in ms the IP gets banned + * @param int $banTimeIncrement Increment for ban time * @param string $blacklist Blacklist of IPs, e.g. "10.10.10.0/24, 10.100.8.4/32" + * @param int $max_attempts Maximum amount of failed login attempts before banning the IP + * @param int $netban_ipv4 Netmask for IPv4 addresses, e.g, 24 for /24 + * @param int $netban_ipv6 Netmask for IPv6 addresses, e.g, 64 for /64 + * @param int $retry_window Time in seconds for the retry window, e.g. 600 * @param string $whitelist A whitelist, e.g. "mydomain.com, anotherdomain.org" * @return array */ - public function editConfig(int $bantimeInMs, string $blacklist, int $max_attempts = 5, int $netban_ipv4 = 24, int $netban_ipv6 = 64, int $retry_window = 600, string $whitelist = null){ + public function editConfig(int $bantimeInMs, int $banTimeIncrement, string $blacklist, int $max_attempts = 5, int $netban_ipv4 = 24, int $netban_ipv6 = 64, int $retry_window = 600, string $whitelist = null){ return $this->MailCowAPI->post('edit/fail2ban', [ "attr"=> [ "ban_time" => $bantimeInMs, + "ban_time_increment" => $banTimeIncrement, "blacklist" => $blacklist, "max_attempts" => $max_attempts, "netban_ipv4" => $netban_ipv4, diff --git a/src/Quarantine/Quarantine.php b/src/Quarantine/Quarantine.php index 194b781..146211d 100644 --- a/src/Quarantine/Quarantine.php +++ b/src/Quarantine/Quarantine.php @@ -26,4 +26,19 @@ public function deleteItem(string $id){ public function getAllQuarantineMails(){ return $this->MailCowAPI->get('get/quarantine/all'); } + + /** + * `editQuarantineItems` - Edit one or multiple items in quarantine + * @param array $items An array of items to edit, e.g. ['item1', 'item2', 'item3'] + * @param string $action The action to perform on the items, e.g. 'release', 'delete', 'quarantine' + * @return array + */ + public function editQuarantineItems(array $items, string $action){ + return $this->MailCowAPI->post('edit/qitem', [ + "items" => $items, + "attr" => [ + "action" => $action + ] + ]); + } } \ No newline at end of file diff --git a/src/QueueManager/QueueManager.php b/src/QueueManager/QueueManager.php index 63d821c..3673760 100644 --- a/src/QueueManager/QueueManager.php +++ b/src/QueueManager/QueueManager.php @@ -15,7 +15,7 @@ public function __construct(MailCowAPI $MailCowAPI){ * @return array */ public function deleteQueue(){ - return $this->MailCowAPI->post('delete/mailq'); + return $this->MailCowAPI->post('delete/mailq', ["action" => "super_delete"]); } /** @@ -23,7 +23,7 @@ public function deleteQueue(){ * @return array */ public function flushQueue(){ - return $this->MailCowAPI->post('edit/mailq'); + return $this->MailCowAPI->post('edit/mailq', ["action" => "flush"]); } /** diff --git a/src/Ratelimits/Ratelimits.php b/src/Ratelimits/Ratelimits.php index 05f914d..a636fe9 100644 --- a/src/Ratelimits/Ratelimits.php +++ b/src/Ratelimits/Ratelimits.php @@ -12,7 +12,7 @@ public function __construct(MailCowAPI $MailCowAPI){ /** * `getMailboxRatelimits()` - Returns the given mailbox' rate limits - * @param string $mailbox + * @param string $mailbox The mailbox name or "all" to get all mailboxes * @return array */ public function getMailboxRatelimits(string $mailbox){ @@ -21,7 +21,8 @@ public function getMailboxRatelimits(string $mailbox){ /** * `getDomainRatelimits()` - Returns the given domain's rate limits - * @param string $domain + * @param string $domain The domain name or "all" to get all domains + * @return array */ public function getDomainRatelimits(string $domain){ return $this->MailCowAPI->get('get/rl-domain/' . $domain); diff --git a/src/Resources/Resources.php b/src/Resources/Resources.php index 393e063..fc4bd31 100644 --- a/src/Resources/Resources.php +++ b/src/Resources/Resources.php @@ -12,7 +12,7 @@ public function __construct(MailCowAPI $MailCowAPI){ /** * `deleteResource()` - Deletes given resource - * @param string $resourceMail + * @param string $resourceMail The email address of the resource to delete * @return array */ public function deleteResource(string $resourceMail){ diff --git a/src/Routing/Routing.php b/src/Routing/Routing.php index 04b67d8..e2c9210 100644 --- a/src/Routing/Routing.php +++ b/src/Routing/Routing.php @@ -12,7 +12,7 @@ public function __construct(MailCowAPI $MailCowAPI){ /** * `addRelayHost()` - Add a new relay host to relay emails to - * @param string $hostname The hostname + * @param string $hostname The hostname e.g. "mail.domain.tld:25 * @param string $password The password for authentication * @param string $username The username for authentication */ @@ -62,19 +62,19 @@ public function deleteTransportMap(int $id){ /** * `getRelayHost()` - Returns given relay's host configuration - * @param int $id ID of the relay host + * @param int|string $id ID of the relay host or "all" to get all relay hosts * @return array */ - public function getRelayHost(int $id){ + public function getRelayHost(int|string $id){ return $this->MailCowAPI->get('get/relayhost/' . $id); } /** * `getTransportMap()` - Returns given transport map's configuration - * @param int $id ID of the transport map + * @param int|string $id ID of the transport map or "all" to get all transport maps * @return array */ - public function getTransportMap(int $id){ + public function getTransportMap(int|string $id){ return $this->MailCowAPI->get('get/transport/' . $id); } } \ No newline at end of file diff --git a/src/Status/Status.php b/src/Status/Status.php index fd556fe..7e981b4 100644 --- a/src/Status/Status.php +++ b/src/Status/Status.php @@ -20,6 +20,7 @@ public function getContainerStatus(){ /** * `getSolr()` - Returns the status of Solr + * @deprecated This function has been deprecated in mailcow version 2025-01 as Solr has been removed. * @return array */ public function getSolr(){ diff --git a/src/SyncJobs/SyncJobs.php b/src/SyncJobs/SyncJobs.php index 21c8d0d..dce1b9d 100644 --- a/src/SyncJobs/SyncJobs.php +++ b/src/SyncJobs/SyncJobs.php @@ -49,6 +49,16 @@ public function createSyncJob(string $username, string $host1, string $port1, st ]); } + /** + * `updateSyncJob()` - Updates an existing sync job + * @param int $id The ID of the sync job to update + * @param array $attributes An associative array of attributes to update, e.g. ['active' => 1, 'mins_interval' => 30], see above function (createSyncJob) for available attributes and their types + * @return array|string + */ + public function updateSyncJob(int $id, array $attributes){ + return $this->MailCowAPI->post('edit/syncjob/' . $id, $attributes); + } + /** * `deleteSyncJob()` - Deletes one or multiple Sync Job * @param array $ids An array of IDs of the sync jobs to delete, e.g. [1, 2, 3] diff --git a/src/oAuth/oAuth.php b/src/oAuth/oAuth.php index e83ecfa..b75b2b3 100644 --- a/src/oAuth/oAuth.php +++ b/src/oAuth/oAuth.php @@ -23,7 +23,7 @@ public function addClient(string $redirect_uri){ /** * `deleteClient()` - Delete a oAuth2 client with given ID - * @param int $id + * @param int $id The ID of the client to delete * @return array */ public function deleteClient(int $id){ @@ -32,10 +32,10 @@ public function deleteClient(int $id){ /** * `getClient()` - Get oAuth2 client configuration - * @param int $id + * @param int|string $id The ID of the client or "all" to get all clients * @return array */ - public function getClient(int $id){ + public function getClient(int|string $id){ return $this->MailCowAPI->get('get/oauth2-client/' . $id); } } \ No newline at end of file