Skip to main content

Email: Subdirectory/Mailbox Creation

Comments

3 comments

  • cPanelMichael
    Hello Michael, The following UAPI function is available for creating email accounts: UAPI Functions - Email::add_pop - Software Development Kit - cPanel Documentation The default directories associated with email accounts are created automatically once the email account is setup. As far as custom mail folders, there's no corresponding API function for that because custom email folders are created in the email or webmail client. Thank you.
    0
  • shashaa
    Hello Michael, The following UAPI function is available for creating email accounts: status == 1) { echo "Error"; } else { echo "Email added"; } to create a single email address, but what i want is to be able to create a lot of email id. I do not see anything on this sample_one@example.com, sample_two@example.com. sample_three@example.com. sample_four@example.com. I get: Notice: Undefined variable: cPanel in C:\xampp\htdocs\auth\ajax.php on line 525 Fatal error: Uncaught Error: Call to a member function execute() on null in C:\xampp\htdocs\auth\ajax.php:525 Stack trace: #0 C:\xampp\htdocs\auth\ajax.php(658): (Array) #1 [internal function]: {closure}('canva@sample.c[/EMAIL]...', 'd%sxy$d3}2*uo32...', 'encrypted') #2 C:\xampp\htdocs\auth\ajax.php(673): array_map(Object(Closure), Array, Array, Array) #3 {main} thrown in C:\xampp\htdocs\auth\ajax.php on line 525 When I do this $marray_three = ALL EMAIL USERNAMES TO ADD $marray_two = ALL CORRESPONDING PASSWORDS $marray_four = DOMAIN TO USE eg example.com array_map(function ($marray_three, $marray_two,$marray_four) { $marray_three; $marray_two; $marray_four; $email_quota = "0"; $parameters = [ 'email' => $marray_three, //username 'password' => $marray_two, //password 'domain' => $marray_four, //domain 'quota' => $email_quota, ]; $result = $cPanel->execute('uapi', "Email", "add_pop", $parameters); }, $marray_three, $marray_two,$marray_four); to try to add an array list of email addresses from database but I keep getting the error above. What am I doing wrong.
    0
  • cPRex Jurassic Moderator
    I can't really comment on the PHP side of things as I don't speak PHP and I'm not a developer. When I work with the API I usually try and ensure the basic commands work directly on the command line before adding them to any additional tools. For this work, I'd be included to use a for loop along with the API call from the command line to iterate through a list of addresses.
    0

Please sign in to leave a comment.