I am trying to create email account in cpanel using php like test@mydomain.com
. I tried cpanel api's , xml api etc.
fopen ("http://$cpuser:$cppass@$cpdomain:2083/frontend/$cpskin/mail/doaddpop.html?email=$euser&domain=$edomain&password=$epass"a=$equota", "r");
this gives me error "Cannot create email account. Possible reasons: "fopen" function allowed on your server, PHP is running in SAFE mode"
but not worked any more. can any one tell me what is the problem exactly, is there any settings I have to set up in server or any thing else.
thank you in advance :)
As the error suggests probably you have allow_url_fopen on the disabled_functions list on your php.ini (default location would be /usr/lib/php.ini).
Alternatively you can use the perl script provided by cPanel to create an email address from command line:
/scripts/addpop user@domain.com password quota#
Example:
/scripts/addpop contact@abc.com password 1024 (this will create the email address contact@abc.com with the password 'password' and with 1024M (1G) as quota
If you do want to use that in a php script then use the php shell_exec() function to execute the command above and you're good to go.
I would advise against enabling allow_url_fopen in php.ini long termn and leave it like that since it might pose security risks to your server.