# API: Add Banned Email Domain
# addBannedEmailDomain
Add new entry to banned email domain list
# Required parameters
Parameter | Description |
---|---|
email | Email Domain to banned |
reason | Ban reason |
expires | Ban expiration date YYYY-mm-dd format |
expirestime | Ban expiration time HH:mm format |
# Request
GET /admin/api.php?api_id=API_ID&api_key=API_KEY&call=addBannedEmailDomain&email=EMAIL&reason=REASON&expires=EXPIRES&expirestime=EXPIRESTIME
# PHP Samples
$url = 'http://url_to_hb.com/admin/api.php';
$post = [
'call' => 'addBannedEmailDomain',
'api_id' => $API_ID,
'api_key' => $API_KEY,
'email' => $EMAIL,
'reason' => $REASON,
'expires' => $EXPIRES,
'expirestime' => $EXPIRESTIME,
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$data = curl_exec($ch);
curl_close($ch);
$return = json_decode($data, true);
print_r($return);
include 'class.hbwrapper.php';
HBWrapper::setAPI('http://url_to_hb.com/admin/api.php','API ID','API Key');
$params = [
'email' => $EMAIL,
'reason' => $REASON,
'expires' => $EXPIRES,
'expirestime' => $EXPIRESTIME,
];
$return = HBWrapper::singleton()->addBannedEmailDomain($params);
print_r($return);
/* Use this method to access HostBill api from HostBill modules */
$api = new ApiWrapper();
$params = [
'email' => $EMAIL,
'reason' => $REASON,
'expires' => $EXPIRES,
'expirestime' => $EXPIRESTIME,
];
$return = $api->addBannedEmailDomain($params);
print_r($return);
# Response
{
"success": false,
"call": "addBannedEmailDomain",
"server_time": 1730115194,
"info": [
"New email domain ban rule added"
]
}