PHP Classes
elePHPant
Icontem

PHP CPanel Create Email Account: Manage email accounts using CPanel API

Recommend this page to a friend!
  Info   View files Documentation   View files View files (11)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2019-02-19 (8 months ago) RSS 2.0 feedNot enough user ratingsTotal: 107 All time: 9,175 This week: 382Up
Version License PHP version Categories
php-cpanel-email 1.0.0Custom (specified...5Email, PHP 5, Web services
Description Author

This package can manage email accounts using CPanel API.

It can send HTTP requests to the CPanel API Web server to perform several types of operations to manipulate email accounts in a hosting environment managed by CPanel. Currently it can:

- Get the list of all email accounts for a domain
- Create a new email account
- Delete an email account
- Change an email account's password or disk quota

  Performance   Level  
Name: Naif Alshaye <contact>
Classes: 20 packages by
Country: Saudi Arabia Saudi Arabia
Age: ???
All time rank: 23109 in Saudi Arabia Saudi Arabia
Week rank: 144 Up1 in Saudi Arabia Saudi Arabia Up
Innovation award
Innovation award
Nominee: 6x

 

Details

PHP Laravel cPanel

A php laravel package to manage cPanel email accounts

  • Get a list of all email accounts.
  • Create a new email account.
  • Delete an email account.
  • Change an email account's password.
  • Change an email account's disk quota.

Installation

composer require naif/php-cpanel-email

If your Laravel below 5.5 you need to add service provider and alias to config/app.php

Under Providers:
\Naif\cPanelMail\cPanelServiceProvider::class,

Under aliases:
'cPanel' => \Naif\cPanelMail\Facades\cPanelMail::class,

Add these to your .env

CPANEL_DOMAIN=your_domain.com
CPANEL_HOST=https://your_domain.com
CPANEL_PORT=2083 // cPanel port Default is: 2083
CPANEL_VERSION=2 // cPanel api current version
CPANEL_USERNAME=your_cpanel_username
CPANEL_PASSWORD=your_cpanel_password

Usage

Create a class object

$cpanel = new cPanel()

Get a list of all email addresses

$cpanel->getEmailAddresses()

Response:
array:5 [
  0 => Email {#227 ?
    +user: "abc"
    +domain: "domain.com"
    +email: "abc@domain.com"
    +_diskused: 0
    +_diskquota: 0
    +humandiskused: "None"
    +humandiskquota: "None"
    +suspended_incoming: 0
    +suspended_login: 0
    +mtime: 1539715896
   }
 ]

Create a new email account

$cpanel->create('username','password')

Response:
[
  "status" => "success"
  "message" => "Email address has been added successfully"
]

Delete an email account

$cpanel->delete('email_address')

Response:
[
  "status" => "success"
  "message" => "Email address has been deleted successfully"
]

Change an email account's password

$cpanel->changePassword('username','password')

Response:
[
  "status" => "success"
  "message" => "Password has been changed successfully"
]

Change an email account's disk quota

$cpanel->changeQuota('username',500)//quota as a number or 0 to set it as unlimited

Response:
[
  "status" => "success"
  "message" => "Email disk quota has been changed successfully"
]

Support:

naif@naif.io

https://www.linkedin.com/in/naif

License

The MIT License (MIT). Please see License File for more information.

  Files folder image Files  
File Role Description
Files folder imagesrc (6 files, 1 directory)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file composer.lock Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  src  
File Role Description
Files folder imageFacades (1 file)
  Accessible without login Plain text file Config.php Aux. Auxiliary script
  Plain text file cPanel.php Class Class source
  Plain text file cPanelBaseModule.php Class Class source
  Plain text file cPanelEmail.php Class Class source
  Plain text file cPanelServiceProvider.php Class Class source
  Plain text file Email.php Class Class source

  Files folder image Files  /  src  /  Facades  
File Role Description
  Plain text file CpanelMail.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:107
This week:0
All time:9,175
This week:382Up
User Comments (2)
Thats a very good class !
8 months ago (Josť Filipe Lopes Santos)
70%StarStarStarStar
Thats a very good class !
8 months ago (Josť Filipe Lopes Santos)
70%StarStarStarStar