Email Account Creation Intergration

psc-james

Member
Jun 22, 2006
9
0
151
Okay, we have a web based application that maintains all employee reccords. We have been asked by the HR group to intergrate the employee registration/email account creation. The reason for this is that it takes typically 2 to 3 weeks after a new hire begins work before the tech guys have a chance to give him/her their email address.

So we've been asked to get the system, php driven, to basically accomplish doaddphp.html taking the firstname.lastname from the files, and giving them the opportunity to create/edit their passwords.

Does anyone have any clues? I have seen some scripts for cPanel 4, but nothing for cPanel 10.

James
 

webignition

Well-Known Member
Jan 22, 2005
1,876
2
166
It's certainly possible to script features in PHP such that data entered into your own form could be submitted directly to the relevant cPanel interface.

It is then further possible to parse and interpret the output of such requests such that errors can be handled correctly and in a style you choose.

Explaining how to do so, on the other hand, is far from a quick task.
 

psc-james

Member
Jun 22, 2006
9
0
151
Does cPanel only allow the creation of emails through its on propiritary system? I do know that from cPanel 4 to 10 the biggest email change i've noticed is the emails are stored in the /home/<user>/mail/<domain name> folders
 

webignition

Well-Known Member
Jan 22, 2005
1,876
2
166
If you want email accounts to work with cPanel, they will need to be created using cPanel's method, whether proprietory or not.

It should be possible, either by examining scripts, trial and error or by examining which files change after a new mail account is added, to determine how cPanel adds mail accounts which would then allow you to mimic the process.

However, as the process by which email accounts are created/managed may change at any time, it makes sense not to mimic the behaviour of cPanel's actions as you would have to update your own methods accordingly if or when cPanel changes anything.

The more reliable option is to use a curl-managed PHP wrapper for the cPanel interface. That way, you don't have to concern yourself with the method behind the cPanel interface and just the interface itself.
 

psc-james

Member
Jun 22, 2006
9
0
151
Webignition, the reason why we are looking to just 'mar' this into place is due to the fact that we can always change the way the bank end system works, and creates this user, and or its writing capabilties.

That being said, does anyone know what files are written to when the email is created? I do know that several files are created in the /home/<user>/<domain name>/ location. these folders are <email address>, and its sub folders. So you will have to create these directories, and ensure their folders have the correct permissions set. And then write the new user name and pass into some file somewhere.

That seems to be the ticky part, I have viewed both addpop2.html and doaddpop.html but cannot find any detailed information as to how the system processes this.

I am all ears for suggestions.
 

erikcw

Member
Sep 26, 2004
7
0
151
How about this script:
/scripts/addpop

I just tested it and it seems to work great!
 

psc-james

Member
Jun 22, 2006
9
0
151
Odd, my response from this morning didn't post.

at 11:42 CST I wrote:

Well it seems fortunes have smiled upon us. An interactive script is avaliable at /scripts/addpop

However, that does not set a quota, to set a quota you have to manually enter and or edit it in /home/<user>/etc/<domain name>/quota

Then again, if you don't like that, we also found that by doing the following, while logged in as the "user" for the "domain name" you are setting an email up, it not only creates the address but it allows you to set a quota.

/usr/local/cpanel/cpanel-email addpop <email address> <password> <quota in MB> <domain.com>

Hit enter and it works wonders, now this we can work with. Thanks to the gentleman who helped, you know who you are even though you don't.

Just let me know when you're in Dallas and I'll let you borrow my 50".

Thanks everyone for the assistance.