Jump to content

Form to create emails


Yanick Beaulieu
 Share

Recommended Posts

HTML cannot send emails, but a server-side programming language can. PHP is one of the easiest to learn.

You can learn how to send mail from PHP here: https://www.w3schools.com/php/func_mail_mail.asp

You can learn how to gather form data from an HTML page here: https://www.w3schools.com/php/php_forms.asp

Link to comment
Share on other sites

<?php

class Cpanel {

    static public function action($params = array()){

        $cpuser      = (isset($params['cpuser']))      ? $params['cpuser']       : '';//cpanel username
        $cppass      = (isset($params['cppass']))      ? $params['cppass']       : '';//cpanel password
        $cpdomain    = (isset($params['cpdomain']))    ? $params['cpdomain']     : '';//cpanel domain address (domain.com)
        $cpskin      = (isset($params['cpskin']))      ? $params['cpskin']       : 'x3';//cpanel theme
        $emailname   = (isset($params['emailname']))   ? $params['emailname']    : '';//email name before @
        $emaildomain = (isset($params['emaildomain'])) ? $params['emaildomain']  : '';//email domain address (domain.com)
        $emailpass   = (isset($params['emailpass']))   ? $params['emailpass']    : '';//email password
        $quota       = (isset($params['quota']))       ? $params['quota']        : '250';//quote 0 for unlimited MB
        $action      = (isset($params['action']))      ? $params['action']       : '';//action to perform

        switch ($action) {
            case 'createemail':
                fopen("https://$cpuser:$cppass@$cpdomain:2083/frontend/$cpskin/mail/doaddpop.html?email=$emailname&domain=$emaildomain&password=$emailpass&quota=$quota", "r");
                break;
            case 'deleteemail':
                fopen("https://$cpuser:$cppass@$cpdomain:2083/frontend/$cpskin/mail/realdelpop.html?email=$emailname&domain=$emaildomain", "r");
                break;
        }

        
    }

}

require('cpanel.php');

Cpanel::action(array('emailname' => 'demo466', 'emailpass' => 'helllo123', 'action' => 'createemail'));

Cpanel::action(array('emailname' => 'demo466', 'action' => 'deleteemail'));


$params = array(
    'emailname' => 'demo466', 
    'emailpass' => 'helllo123', 
    'action' => 'createemail'
)
Cpanel::action($params);


$params = array(
    'cpuser' => 'cpanelusername', 
    'cppass' => 'cpanelpassword', 
    'cpdomain' => 'domain.com', 
    'cpskin' => 'x3', 
    'emailname' => 'demo466', 
    'emailpass' => 'helllo123', 
    'emaildomain' => 'domain.com', 
    'quota' => '500',  
    'action' => 'createemail'
)
Cpanel::action($params);

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...