1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

how to creat mail account with php ?

Discussion in 'Plesk for Linux - 8.x and Older' started by muratak18, Nov 17, 2007.

  1. muratak18

    muratak18 Guest

    0
     
    i have linux server and qmail installed. i want to creat mail account with php. i searched over the net but couldnt anything. Is there a way to creat mail account without plesk panel?
     
  2. Monica@

    Monica@ Guest

    0
     
    What do you mean "create mail account with PHP"? Do you want to create the mailbox from the command line? If yes, Plesk has the command line utilities, try
    /usr/local/psa/bin/mail (use with --help to get the usage info).
    To get the info about how to create mail account without plesk it's better to read the qmail manual
    http://www.lifewithqmail.org/lwq.html
     
  3. muratak18

    muratak18 Guest

    0
     
    i have a registeration form. when users sign up , php will creat a mail account for that username like somebody@site.com . i dont know php can do this but i need to execute qmail and creat new mail account. how can i do this ?

    thanks...
     
  4. Monica@

    Monica@ Guest

    0
     
    /usr/local/psa/bin/mail utility can create the mail account. Insert its execution with necessary parameters in the code.
     
  5. muratak18

    muratak18 Guest

    0
     
    thank you very much monica for your help i will try it.
     
  6. Blackbit@

    Blackbit@ Guest

    0
     
    PHP creating Boxes

    Watch out, that this form is not accessible for spammers/ hackers. ;-)

    But anyway, it could be done like this (with activating DrWeb and SpamAssassin). I've used such commands in PHP-CLI:

    PHP:
    exec ("/usr/local/psa/bin/mail.sh --create \"".$ACCOUNT."\" -passwd \"".$PASSWD."\" -antivirus in -manage-drweb true -manage-spamfilter true -mailbox true");
    $ACCOUNT should contain the full email-adress with domain.
     
  7. muratak18

    muratak18 Guest

    0
     
    Thank you Blackbit for the php code.

    i have a question :

    i executed the code with putty and it worked but i tried with php nothing happened and no errors. what am i doing wrong ?

    i dont know much about linux command.

    thank you again
     
  8. Blackbit@

    Blackbit@ Guest

    0
     
    On some servers Apache PHP doesn't allow some commands wich can be security holes, like allowing commands on your shell.

    Check your PHP-Setup in /etc/php5/apache2/php.ini for this entry: disable_functions.
    Maybe exec is deactivated by being listet there.

    Also it might be that your PHP can't execute that target script "/usr/local/psa/bin/mail.sh". Check the execution rights. Maybe it helps to allow the group .www the execution of it:

    Execute this on your SSH-Shell:
    But remember, this can be a security problem.

    Also you can find some information about this in your Apache log.
     
  9. Blackbit@

    Blackbit@ Guest

    0
     
    Another idea:

    To log what happens by executing the mail-creation with this modification:

    exec ("/usr/local/psa/bin/mail.sh --create \"".$ACCOUNT."\" -passwd \"".$PASSWD."\" -manage-spamfilter true -mailbox true 2&> creation.log");

    Which writes all the output of mail.sh into the file creation.log. Look at this after trying to create an account.
     
Loading...