Creating an email account with UAPI error

kylediablo

Registered
Jul 21, 2019
2
0
1
Seattle, WA
cPanel Access Level
Root Administrator
Hello!
I am fairly new to development. I am attempting a basic call to create an email address. There are three parts that I need for the liveapi, as far as I understand. I have the index.php with the form, the formhandler.php to reach the last script, addmail.livephp that is in the theme directory.

I am getting a 500 error, and there are no useful error logs as far as I can find that let me know what is going wrong.

(yes I know that I am not using best practices for form input right now, I will be sanitizing and validating input after I can get it working)


Here is what I have:
Code:
addmail.livephp
located at /usr/local/cpanel/base/frontent/paper_lantern

<?php


require_once "/usr/local/cpanel/php/cpanel.php";

$domain = 'example.com';
$username = $_POST['username'];
$password = $_POST['password'];



$cpanel = new CPANEL();
 

$get_userdata = $cpanel->uapi(
    'Email',
    'add_pop',
    array(
        'email'           => $username,
        'password'        => $password,
        'quota'           => '0',
        'domain'          => $domain,
        'skip_update_db'  => '1',
    )
);

?>
------------------------------------------------
index.php
located at public_html
<form action="formhandler.php" method="post">
        username: <br>
        <input type="text" name="username"> <br>
        Password: <br>
        <input type="text" name="password">
        <input type="submit" value="Submit">
</form>
--------------------------------------------------
formhandler.php
located at public_html

<?php
include "../../../usr/local/cpanel/base/frontend/paper_lantern/addmail.livephp";
Any guidance would be greatly appreciated!
 

kylediablo

Registered
Jul 21, 2019
2
0
1
Seattle, WA
cPanel Access Level
Root Administrator
Apologies for the readability of the code, I am unable to edit my message to break the files into separate code blocks or edit my post in any way as the forum marks it as spam or inappropriate.
 

cPanelLauren

Forums Analyst II
Staff member
Nov 14, 2017
6,762
535
263
Houston
cPanel Access Level
DataCenter Provider