Jump to content
Sign in to follow this  
Yanick Beaulieu

Form to create emails

Recommended Posts

 

I am using the cPanel to create emails but I would like to create emails via an html page and connect it to my cPanel or on the server's smtp connection. To help my clients to create their email directly on a web page

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Create email accounts? That is pretty complicated, I'm afraid I wouldn't know where to begin with that.

Share this post


Link to post
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);

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...