Create Custom Mailboxes using cPanel
If you are using cPanel and you want to add an automated email signup form to your web site that's so easy.
First create an html form and get the following information from user :
- New Email Address.
- Password.
- ... (other information are not required.)
Now set the action of this form to "signup.php" with the POST method and set the value to your email address.
Example :
<FORM name=a method=POST action="signup.php" autocomplete=off>
<input type="hidden" name="to" value="your email address">
Now use the following code as "signup.php" :
----------
<?php
$ok = TRUE;
$file = fopen ("
http://username:password@Server's IP:2082/frontend/Xskin/mail/doaddpop.html?email=$NewEmail&domain=$domain&password=$Password"a=50", "r");
if (!$file) {
$ok = FALSE;
$target = "error.htm";
}
while (!feof ($file)) {
$line = fgets ($file, 1024);
if (ereg ("already exists!", $line, $out)) {
$ok = FALSE;
$target = "error.htm";
}
}
fclose($file);
if ($ok) {
$target = "done.htm";
$form_fields=array_keys($HTTP_POST_VARS);
$temp="\n";
while($field=array_pop($form_fields)){
$temp.=" $field : = $HTTP_POST_VARS[$field] \n";
}
mail($HTTP_POST_VARS['to'],"Free Email",$temp);
}
header("location:$target");
?>
----------
username & password = the same as username & password to your cPanel control panel.
Server's IP = Primary Server's IP
Xskin = It may change due to your cPanel skin.
Qyata = Size of the new mailbox in megabyte.
error.htm = If the email address is already exists or there is an error during the operation this page will be shown.
done.htm = If the email is created successfully this page will be shown and an email will be sent to your email address.