|
|
|
|
Like this code?
Show the author your appreciation.
|
|
| |
Create e-mail addresses for cPanel accounts
This is a simple class that can be used create e-mail addresses for domains hosted using a cPanel account.
It extends a script originally made available in the zubrag.com Web site.
The class accesses a cPanel Web server and sends a command to create an e-mail account with a given address, password and quota.
The class retrieves and process the cPanel server response to determine whether the account creation was successful or it could not be created when the account already exists.
cpmail_class.php
| <?php
/*
This class is an extension of script made by www.zubrag.com. You can access the original link from here
http://www.zubrag.com/scripts/cpanel-create-email-account.php
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.
Installation:
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'){
$this->cpuser=$cpuser;
$this->cppass=$cppass;
$this->cpdomain=$cpdomain;
$this->cpskin=$cpskin;
// 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){
$path="http://".$this->cpuser.":".$this->cppass."@".$this->cpdomain.":2082/frontend/".$this->cpskin."/mail/doaddpop.html?quota=".$equota."&email=".$euser."&domain=".$this->cpdomain."&password=".$epass;
$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.');
}
}
fclose($f);
//return success message
return "Email account created.";
}
}
?> | |
//Usage Example
| <?php
/*
This is the example script for cpmail class
*/
?>
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>cPanel Email Creator</title>
</head>
<body>
<p><b><font size="5">Cpanel Email Creator</font></b></p>
<form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<table border="0" width="52%" style="border-collapse: collapse">
<tr>
<td colspan="2">
<p align="left"><b>Create Email Accounts</b></td>
</tr>
<tr>
<td width="78">
<p align="right">Username:</td>
<td><input type="text" name="euser" size="20"></td>
</tr>
<tr>
<td width="78">
<p align="right">Password:</td>
<td><input type="password" name="epass" size="20"></td>
</tr>
<tr>
<td width="78"> </td>
<td><input type="submit" value="Create New Account" name="create"></td>
</tr>
</table>
</form>
<p> </p>
<?php
if(isset($_POST['create'])){
//include class file
require_once('cpmail_class.php');
/*
instanceiate class & pass three arguments cpanelusername, cpanelpassword,yourdomainname,cpanelskin
See following URL to know how to determine your cPanel skin
http://www.zubrag.com/articles/determine-cpanel-skin.php
if you don't pass cpanelskin argument, default will be x
*/
$cpanel=new cpmail("rubdnet","secret2001","rubd.net","rvblue");
//call create function and you have to pass three arguments as follows:
//emailid, password, quota
echo $cpanel->create($_POST['euser'],$_POST['epass'],"20");
}
?>
</body>
</html> | |
|
|
| Class for sending mail with MIME attachments in multipart format using external sendmail, mimencode and zip Categories : Email, Network, PHP, PHP Classes | | | Db_lib - practical example usage of database abstraction and form validation.
Categories : PHP, Form Processing, PHP Classes, Data Validation, Beginner Guides | | | cPanel Subdomains Creator - Create cPanel subdomains without logging into cPanel. Let your visitors create their own subdomains without your intervention. Moreover, it will inform if a subdomain is already exists. Categories : PHP, Web Services, PHP Classes | | | Validator - A PHP class that can can be used for validating Email IDs and Dates Categories : PHP, PHP Classes, Data Validation, Email, Date Time | | | Three Cool Classes and One Trick Categories : PHP, PHP Classes, Graphics, Email | | | Form Elements Class Categories : PHP, PHP Classes, Form Processing | | | PHP MIME Decoder. This class decodes Mime Encoded email message.
Attachments are stored in a director. Works with Multipart/alternative,
multipart/mixed etc.
see http://p3mail.com for example. Categories : PHP, PHP Classes, Email | | | FormChecker Package - validate any data via classes and patterns.
Categories : PHP, Form Processing, PHP Classes, Regexps | | | send_mail function to defeat Header Injection Hacking/Spamming Categories : PHP, Email, Form Processing, Security | | | Class that allows the PHP developer to establish connections with a POP3 mail server amd be able to list, retrieve and delete mail messages from a given mail box.
Categories : Network, Email, PHP, PHP Classes | | | Freshmeat.net XML-RPC - This class is meant to query Freshmeat for information about registered projects. Categories : PHP, PHP Classes, XML, Web Services | | | A class for sending email; it has support for To:, Cc:, Bcc: and Reply-To:
headers. It requires that you have sendmail installed. Categories : Email, PHP Classes, PHP | | | file class , uploade file , download file already uploaded on another website Categories : PHP, PHP Classes, Filesystem, Web Services | | | send php mail with form data and attachment. Categories : PHP, Email, Mail, Form Processing | | | POP3 Class Categories : PHP Classes, PHP, Email | |
|
|
|