Create a new email account from php script on dovecot/postfix

922

I'd like to make a page to allow people to create new email accounts on a dovecot/postfix server (via imap).

I've seen the php functionsimap_open andimap_createmailbox, but these functions don't create accounts, it only creates a new directory :/ (and you need the login/password of an existing account to useimap_open...)

So I'd like to know if it's possible to do this :).

Edit

I'm adding this because my previous message wasn't specific enough. I need a front page to allow the users to register a new mailbox and to check if their wanted mail alias is free or not. That's why most of the web-based admin are not good for me. I don't want the end-users to see the admin panel.

145

Answer

Solution:

Well. The answer depends on where the list of user accounts for dovecot and postfix is stored on your server. I.e. where do dovecot and postfix retrieve user accounts from. I.e. dovecot and postfix do not maintain their own lists of user accounts, they just take some existing list. For example, several years ago I had configured dovecot and postfix so that they were taking list of user accounts (and respective e-mail addresses, storage paths, etc) from MySQL database. In such implementation it would be enough just to insert several records in that MySQL database for adding new email account.

I don't know how dovecot and postfix are configured on your server. Maybe they are just using system user accounts (then you need to add user account withuseradd/adduser), maybe they retrieve user account list from LDAP (then you need to insert users into LDAP), or just from plain config file (then you need to edit config file).

People are also looking for solutions to the problem: Please i need some help php SELECT FROM WHERE

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.