Hi, all
Long time lurker and user of mailcow.
We have been building some integrations using the API and found we needed to list bcc address rewrites by domain as /all lists all entries but no filter by domain.
I made a small change to allow filter by domain in json_api.php, which looks like so (php is not first language so go easy ):
case "bcc":
switch ($object) {
case "all":
$domain = $extra;
$bcc_items = bcc('get');
if (!empty($bcc_items)) {
foreach ($bcc_items as $bcc_item) {
if ($details = bcc('details', $bcc_item)) {
if (empty($domain)) {
$data[] = $details;
} else {
if ($details['domain'] == $domain ) {
$data[] = $details;
}
}
}
else {
continue;
}
}
}
process_get_return($data);
break;
This has worked great for us, which brings me to my next questions.
- How do I protect the changes with out losing access to new updates json_api.php
- Should I submit a PR if code is worthy
I don’t want to submit this as a bug request as its not really a bug. Any advance would be appreciated.