Is there a way to create new email accounts using php? There must be right? Many sites will give you a mailbox as soon as you register.
How do they do it?
This is for Linux, I don't have any experience with Windows Mail Servers.
Mail servers (MTAs) by default will generally save user mail under their user accounts (shell accounts).
Thus email accounts, are tied to user accounts on the server. So in order to provide mail for a user you have to create an account for them on the server.
Creating user accounts can only be done as root.
PHP running on the server, unfortunately cannot create user accounts directly since the PHP script executes under the webserver user, which won't be root due to security concerns.
You could switch to root from PHP, or invoke a shell script that runs with root privileges, but this has security concerns.