Location: PHPKode > scripts > cPanel Email Accounts > cpanel-email-accounts/cpmail_class.php
This class is an extension of script made by www.zubrag.com. You can access the original link from here

Class Name: cpmail
Clas Title: cPanel Mail Accounts Creator
Purpose: Create cPanel email account without loggin in to cPanel.
Version: 1.0
Author: Md. Zakir Hossain (Raju)
URL: http://www.rajuru.xenexbd.com

Company: Xenex Web Solutions
URL: http://www.xenexbd.com

License: GPL
You can freely use, modify, distribute this script. But a credit line is appreciated.

see example.php for details


//definding main class
class cpmail{
  //declare public variables
  var $cpuser;    // cPanel username
  var $cppass;        // cPanel password
  var $cpdomain;      // cPanel domain or IP
  var $cpskin;        // cPanel skin. Mostly x or x2.
  //defining constructor
  function cpmail($cpuser,$cppass,$cpdomain,$cpskin='x'){
	// See following URL to know how to determine your cPanel skin
	// http://www.zubrag.com/articles/determine-cpanel-skin.php

  //now create email account, function takes three arguments
  $euser = email id
  $epass = email password
  $equota = mailbox allocated size
  function create($euser,$epass,$equota){
    $f = fopen($path,"r");
	if (!$f) {
	  return('Cannot create email account. Possible reasons: "fopen" function not allowed on your server, PHP is running in SAFE mode');

    //check if the account exists
    while (!feof ($f)) {
	  $line = fgets ($f, 1024);
	  if (ereg ("already exists!", $line, $out)) {
	    return('Such email account already exists.');
    //return success message
	return "Email account created.";

Return current item: cPanel Email Accounts