Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/AddressRewrite/AddressRewrite.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion src/DKIM/DKIM.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]]);
}

/**
Expand Down
10 changes: 5 additions & 5 deletions src/DomainAdmin/DomainAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)]
]);
}

Expand Down
4 changes: 3 additions & 1 deletion src/Domains/Domains.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
}
}
8 changes: 7 additions & 1 deletion src/Fail2Ban/Fail2Ban.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
15 changes: 15 additions & 0 deletions src/Quarantine/Quarantine.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
]
]);
}
}
4 changes: 2 additions & 2 deletions src/QueueManager/QueueManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ 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"]);
}

/**
* `flushQueue()` - Flush server-wide mail queue
* @return array
*/
public function flushQueue(){
return $this->MailCowAPI->post('edit/mailq');
return $this->MailCowAPI->post('edit/mailq', ["action" => "flush"]);
}

/**
Expand Down
5 changes: 3 additions & 2 deletions src/Ratelimits/Ratelimits.php
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/Resources.php
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand Down
10 changes: 5 additions & 5 deletions src/Routing/Routing.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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);
}
}
1 change: 1 addition & 0 deletions src/Status/Status.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(){
Expand Down
10 changes: 10 additions & 0 deletions src/SyncJobs/SyncJobs.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
6 changes: 3 additions & 3 deletions src/oAuth/oAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand All @@ -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);
}
}
Loading