How to create an Email Account in Cpanel via PHP? [closed]

♀尐吖头ヾ 提交于 2019-12-18 15:05:46

问题


How do I create email accounts with PHP using the xmlapi.php library from cPanel?

Note: I need to create more than 1000 email accounts and want to know if this is possible.

Thanks.


回答1:


UPDATED

I have updated your question and based on that providing this answer.

1. I see bunch of API's for cPanel for managing the server. Though I don't find a direct API for creating a new email account, but found a script which would help you creating email account.

Please see this link:

http://www.zubrag.com/scripts/cpanel-create-email-account.php

http://forums.cpanel.net/f42/xmlapi-php-class-111897.html




回答2:


You can automate the creation of email id's but creating a http-client that is logging into you cpanel-interface and then performing the needed http-requests to create the email-ids (email accounts).

Something similar has been asked by Iain Clark (Applying .htaccess folder username/password with PHP).

If you write such an automation in PHP you can then create Email-IDs from your PHP script.

Code for similar tasks can be found here and there in the web (e.g. PHP Script To Log Into cPanel), however you should carefully check if that is dealing with your passwords appropriate and that it actually works for your version/style/theme of cpanel.




回答3:


From the discussion I eventually worked out that you're trying to create a username.

Automatic generation of usernames sucks. They do have to be unique though. Why not let your users pick their own names and reject ones that are already in use.



来源:https://stackoverflow.com/questions/6422200/how-to-create-an-email-account-in-cpanel-via-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!