Forum Moderators: coopster

Message Too Old, No Replies

Setting Up New Imap Accounts Automatically

Possible With PHP?

         

brendan3eb

8:51 pm on Jan 27, 2005 (gmt 0)

10+ Year Member



I was wondering if it is possible to automatically setup new imap accounts with php (if not, is there another similar free language that I could use to do this (perl).

-Brendan

jusdrum

9:15 pm on Jan 27, 2005 (gmt 0)

10+ Year Member



This all depends on how the IMAP accounts are being authenticated. If they are authenticated straight to the OS user store, then it will be pretty hard (and very insecure) to set them up with PHP, if you are thinking of doing it as a web based thing.

However, if the users are stored in something else, like LDAP, MySQL, Postgres, or what have you, using PHP to add/edit/delete users should be a snap. In fact the mail server I set up uses MySQL as the user store, and writing a quick PHP app to allow users to add/edit/delete accounts and aliases to their domains was easy.

brendan3eb

10:57 pm on Jan 27, 2005 (gmt 0)

10+ Year Member



I want to make an option for members at my site to get email service. I was thinking about setting up a page that inserts all their email in to a mysql database and run a crontab on it. Is there a single function that can setup imap accounts, if so, what is it?

bobnew32

11:41 pm on Jan 27, 2005 (gmt 0)

10+ Year Member



If you have cpanel on a shared host, google your problem and you should get a good script/help. ;)

brendan3eb

2:56 am on Jan 28, 2005 (gmt 0)

10+ Year Member



I googled for tutorials and I can't find anything on php.net, if anyone has a link to a useful resource on the topic or knows the function that is used to create accounts so I can look it up on php.net, please let me know

dmorison

7:09 am on Jan 28, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Remember that you don't have to limit yourself to PHP internal functions; you can use the program execution [uk.php.net] functions to fire off shell scripts that can then perform any kind of automation task you want.

You do have to make sure that whatever user PHP sees the system as (quite often "apache") has permissions to do whatever your script needs to do.

jusdrum

5:09 pm on Jan 28, 2005 (gmt 0)

10+ Year Member



Remember that you don't have to limit yourself to PHP internal functions; you can use the program execution functions to fire off shell scripts that can then perform any kind of automation task you want.

This is VERY dangerous to do in an application out in the open on the Internet. Never do system calls from PHP if you can help it, especially to add/edit/delete user accounts on a system!

As for the original question, brendan3eb, it looks like you need to do a little researching on how IMAP accounts work. It all depends on your set up, there is no one way it works on everything.

Adding e-mail addresses to a database and having a cron job run through it and add accounts to the system is probably the safest, that way it separates the end user from the actual function of adding an account. Like I mentioned before, adding an IMAP account to a system all depends on how your e-mail server is set up. Try to find out how to add a new IMAP account before choosing your method for allowing users to obtain new accounts from a web site.