2017 © Pedro Peláez
 

yii2-extension yii2-cpanel-email-creator

With this extension you will be able to easly to create cPanel email account from your yii2 application.

image

filipajdacic/yii2-cpanel-email-creator

With this extension you will be able to easly to create cPanel email account from your yii2 application.

  • Sunday, June 26, 2016
  • by filipajdacic
  • Repository
  • 1 Watchers
  • 1 Stars
  • 17 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 1 Versions
  • 6 % Grown

The README.md

cPanel Email Account Creator Extension

With this extension you will be able to easly programatically create,update,delete cPanel email accounts from your yii2 application., (*1)

With this component you are able to:, (*2)

  • Create new mail accounts, (*3)

  • Change existing account disk quota, (*4)

  • Change existing accounts their passwords, (*5)

  • Delet accounts, (*6)

Installation

The preferred way to install this extension is through composer., (*7)

Either run, (*8)

php composer.phar require --prefer-dist filipajdacic/yii2-cpanel-email-creator "*"

or add, (*9)

"filipajdacic/yii2-cpanel-email-creator": "*"

to the require section of your composer.json file., (*10)

Usage

Once the extension is installed, simply use it in your code by putting this in your config:, (*11)

'components' => array(
    ...
    'cpanelemailcreator' => array(
        'class' => 'filipajdacic\cpanelemailcreator\EmailCreator',
        'ip' => 'YOUR_CPANEL_SERVER/HOST_IP_ADDRESS',
        'port' => '2083', // it can be also 2086
        'cpanel_username' => 'YOUR_CPANEL_USERNAME',
        'cpanel_password' => 'YOUR_CPANEL_PASSWORD'
    ),
    ...
);

After you have configured a component, you can use it in this way:, (*12)

1. Create a new mail account:, (*13)


$domain = "mywebsite.com"; $email_username = "john.doe"; $email_password = "myaccountpassword123!"; $email_quota = 500; // in MB $create_mail_account_result = Yii::$app->cpanelemailcreator->createNewAccount( $domain, $email_username, $email_password, $email_quota ); if($create_mail_account_result) { $result = "Mail account ".$email_username."@".$domain." is created."; } else { $result = "Mail account is not created. Reason:".$create_mail_account_result; } echo $result;

Note that password strong policy is defined in WHM (Web Host Manager)., (*14)

2. Change existing email account password:, (*15)


$domain = "mywebsite.com"; $email_username = "john.doe"; $email_new_password = "mynewaccountpassword123$"; $change_password_result = Yii::$app->cpanelemailcreator->changeAccountPassword( $domain, $email_username, $email_new_password ); if($change_password_result) { $result = "Mail account password for ".$email_username." is changed."; } else { $result = "Password is not changed. Reason:".$change_password_result; } echo $result;

3. Change existing email account disk quota:, (*16)


$domain = "mywebsite.com"; $email_username = "john.doe"; $email_new_quota = "10000"; // in MB $change_mail_quota_result = Yii::$app->cpanelemailcreator->changeEmailQuota( $domain, $email_username, $email_new_quota ); if($change_mail_quota_result) { $result = "Mail quota for ".$email_username." is changed to ".$email_new_quota." MB."; } else { $result = "Mail quota is not changed. Reason:".$change_password_result; } echo $result;

4. Deleting existing email account, (*17)


$domain = "mywebsite.com"; $email_username = "john.doe"; $delete_mail_result = Yii::$app->cpanelemailcreator->deleteMailAccount( $domain, $email_username, $email_new_quota ); if($delete_mail_result) { $result = "Mail account ".$email_username."@".$domain." is deleted."; } else { $result = "Mail account is not deleted. Reason:".$change_password_result; } echo $result;

Resources

Yii Framework Extension Page, (*18)

If you have any questions, feel free to ask!, (*19)

The Versions

26/06 2016

dev-master

9999999-dev

With this extension you will be able to easly to create cPanel email account from your yii2 application.

  Sources   Download

MIT

The Requires

 

by Filip Ajdacic

extension yii2 cpanel email create