问题
I need to create an email account in PhP. I found a ton of code samples online that do this, however I have a few problems:
- I'm on a shared server host with the default php.ini, and my host won't change it
- I need to create it via a URL, not with forms (something like: mywebsite.com/email.php?username=user)
- The password and quota created needs to be the same every time, so the only thing after the ? I need is the username
I have 0 experience with PhP so I can't just edit one I find online, so sorry if this is easy. If someone could point me in the direction of a script someone made or something that'd be great! Thanks.
回答1:
From your reply, it turns out that you are using cPanel. This is quite helpful, as cPanel provides its own XML API for some administrative tasks, including creating email accounts.
You can find a ready made script that uses the cPanel XML API and does what you require in this forum post:
http://forums.glowhost.com/programming-talk/using-cpanel-api-creating-email-account-forwarders-your-own-php-scripts-2798.html
This SO question contains information on how to use the cPanel XML API yourself.
If for some reason you can't get the XML API to work, there's another script that makes regular HTTP calls to cPanel itself over here:
http://www.zubrag.com/scripts/cpanel-create-email-account.php
来源:https://stackoverflow.com/questions/16996779/create-an-email-account-with-php-with-some-things-i-need-to-work-around