PDA

View Full Version : automatic creation of email accounts



uprightdog
03-12-2008, 12:27 PM
Is it possible to create a web-based application (preferably a PHP class) that will create POP email accounts? Or can this only be done directly through Plesk?

Down2TheC
03-12-2008, 05:19 PM
Anything on linux can be scripted... though I'd be lost on where to start.

jason
03-13-2008, 08:41 AM
I don't know what plesk uses for its mail server, but it should be scriptable. Most systems simply add a folder someplace to store the incoming mail and add a user to a passwd file.

For example, in cPanel, mail is stored in the /home/user/mail directory structure (with sub directories for each domain hosted on the account and further directories for individual accounts) and the user account settings are stored in /home/user/etc/passwd or some such.

Where you may run into problems is with ownership and permissions. Most web scripts run as nobody, apache, or the owner of the script, but in order for the mail server to put mail into that user's directory it generally needs to either own or have group rights to directory. Most commonly you'll see setups where the directory is owned by the account owner with the group set to "mail," "vpopmail," or something similar depending on platform. This requires a chown which is only available to root.

The way the control pannels handle it, I presume, is to execute scripts on the server with setuid permissions. Of course, if you choose to do this, you should use EXTREME caution as you are effectively elevating a web user to root for a moment.

--Jason