Add email address using linux command line

classywear

Member
Jun 3, 2007
5
0
151
I'm trying to learn how to add an email address to an account at the linux operating system command line. I have search through the cPanel and red hat user guides without success. Can anyone point me in the right direction.

Thanks,
John
 

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,579
55
308
cPanel Access Level
Root Administrator
I'm trying to learn how to add an email address to an account at the linux operating system command line. I have search through the cPanel and red hat user guides without success. Can anyone point me in the right direction.

Thanks,
John
/scripts/addpop
 

cPanelDavidG

Technical Product Specialist
Nov 29, 2006
11,216
10
313
Houston, TX
cPanel Access Level
Root Administrator
Hello classywear!

Now that you know how to create a new email account via command line do you know how to set up an email quota via command line?

I really need to do this.

Thanks in advance.

Cheers.

http://forums.cpanel.net/f4/command-line-commands-creating-setting-up-quota-email-address-119665.html
We are currently working on adding a parameter to the /scripts/addpop script to allow you to set a quota. I have no ETA on when this functionality will become available in the production-worthy builds of cPanel/WHM, but it is currently available in our EDGE build (internal case 28422). Use of EDGE on production web servers is discouraged since EDGE only receives minimal quality testing.
 

gearheadhost

Member
Jun 14, 2009
14
0
51
non-root add email account?

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.
 

cPanelDavidG

Technical Product Specialist
Nov 29, 2006
11,216
10
313
Houston, TX
cPanel Access Level
Root Administrator
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