Is there a way to get a non-root account to be able to setup an email account via ssh or shell_exec via a php script?
Basically I want to be able to add a form in a password protected directory that will allow me to fill out a form to create the email account. Mainly it is for a business setup where multiple managers can setup email accounts for their divisions without cPanel access.
You could just use our APIs for creating an email account. Information about our XML API including how to call the cPanel API1 and API2 APIs from the XML API is available at:
XML and JSON APIs
The actual function call for creating an email account is an API1 function:
Code:
<cpanel Email="addpop($FORM{'email'},$FORM{'password'},$FORM{'quota'},$FORM{'domain'})">
So, to call this from the XML API, you would use
the cPanel function. Here's the relevant information for calling the API:
API version: 1
Module: Email
Function: addpop
First arg: the part of the email address before @
Second arg: password for the email account
Third arg: a number, specifying the quota for this mail account in MB
Forth arg: the part of the email address after @
Matt has made a nifty PHP 5 class that makes calling our APIs much easier if you're using PHP 5. You can find his class at:
http://forums.cpanel.net/f42/xmlapi-php-class-111897.html