I am trying to creating the email account using PHP script in bluehost server. I tried so many script, but it response came either "Access Denied" or file_get_contents(https://...@example.com:2083/frontend/x3/mail/doaddpop.html?email=username@example.com&domain=example.com&password=password"a=25): failed to open stream: HTTP request failed! HTTP/1.0 401 Access Denied like that. Support team said they have no restriction at all. My Code :
Script 1:
include ("xmlapi.php"); 
$account    = "domain.com"; 
$account_pass   = "domainpass";
$email_user = "username@domain.com";
$email_password = "Mailpassword";
$email_domain   = "domain.com"; 
$email_quota    = '0';
$xmlapi = new xmlapi('xxx.xxx.xxx.xxx'); 
$xmlapi->password_auth($account, $account_pass);
$xmlapi->set_output('xml');
echo $result = $xmlapi->api1_query($account, "Email", "addpop", array($email_user, $email_password, $email_quota, $email_domain) );
Script 2:
 $f = fopen ("https://$cpuser:$cppass@$cpdomain:2082/frontend/$cpskin/mail/doaddpop.html?email=$euser&domain=$edomain&password=$epass"a=$equota", "r");
 $error = error_get_last();
 echo "HTTP request failed. Error was: " . $error['message'];
 if (!$f) {
 $msg = 'Cannot create email account. Possible reasons: "fopen" function allowed on your server, PHP is running in SAFE mode';
 break;
 }
Script 3:
$result = $xmlapi->api2_query($cpanel_username, 'Email', 'addpop', $api2args);
Script 4:
 include ("cpaneluapi.class.php");
 $cpanel = new cpanelAPI(); // Connect to cPanel - only do this once.
 //$cPanel = new cpanelAPI('domain.com', 'Password', 'cpanel.domain.com');
 // Create the user@example.com email address.
 $new_email =  $cpanel->curl_request('https://example.com:2087/json-api/cpanel?cpanel_jsonapi_user=user&cpanel_jsonapi_apiversion=2&cpanel_jsonapi_module=Email&cpanel_jsonapi_func=addpop&domain="example.com"&email="user"&password="12345luggage""a="500"');
 // $new_email = $cpanel->api2(
 //     'Email', 'add_pop',
 //     array(
 //         'email'           => 'user',
 //         'password'        => '12345luggage',
 //         'quota'           => '0',
 //         'domain'          => 'example.com',
 //         'skip_update_db'  => '1',
 //         )
 // );
 echo $new_email;