buy
Add Email Account

Description

You can use this Add Email Account API to add Email accounts to your Webuzo panel.

Parameters

Sample Code

curl --insecure -d "add=1" -d "login=EMAIL_USER" -d "newpass=PASSWORD" -d "conf=CONF_PASSWORD" -d "domain=DOMAIN.COM" -d "quota=limited" -d "quota_limit=2048" -u "WEBUZO_USER:USER_PASSWORD" -X POST "https://HOSTNAME_OR_SERVERiP:2003/index.php?api=json&act=add_email_account"
<?php
	$user = 'Webuzo Username';
	$pass = 'Password';
	$host = 'ServerIP / Hostname';
	 
	$url = 'https://'.rawurlencode($user).':'.rawurlencode($pass).'@'.$host.':2003/index.php?api=json&act=add_email_account'; 

	$post = array(
		'add' => '1',
		'domain' => 'domain.com',      // Valid Domain
		'login' => 'EmailUser',	       // Email user
		'newpass' => 'password',
		'conf' => 'password',          // Confirm Password
		'quota' => 'unlimited',        // If set as unlimited it will not set the quota_limit that you pass
		'quota_limit' => '1024',       // If quota value is set as limited then only it will be set
		'incoming' => 'allow', 	       // values : allow, suspend
		'outgoing' => 'allow', 	       // values : allow, suspend
		'allowlogin' => 'allow',       // values : allow, suspend
	);

	// Set the curl parameters 
	$ch = curl_init(); 
	curl_setopt($ch, CURLOPT_URL, $url);
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
	curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); 
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 

	if(!empty($post)){
		curl_setopt($ch, CURLOPT_POST, 1);
		curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
	}

	// Get response from the server. 
	$resp = curl_exec($ch);
	if(!empty(curl_error($ch))){
		echo curl_error($ch); die();
	}

	// The response will hold a string as per the API response method. 
	$res = json_decode($resp, true);
	// Done ?
	if(!empty($res['done'])){
		echo "<pre>";
		print_r($res['done']['msg']);
		echo "</pre>";
	}else{
		print_r($res['error']);
	}
?>

Output

Email user created successfully.
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list