How Create email a new by php

alokeme

Verified User
Joined
Mar 24, 2009
Messages
6
Hi,


da_create_mail.php
PHP:
<?php

include 'httpsocket.php';

$passwd 	= $_POST[passwd];
$domain 	='*****';
$user 	= $_POST[user];

$sock = new HTTPSocket;
$sock->connect('*********',2222);

$sock->set_login("******","********");

$sock->set_method('POST');

$sock->query('CMD_API_POP',
    array(
        'action' => 'create',
        'domain' => '$domain',
        'user' => '$user',
        'passwd' => '$passwd',
        'quota' => '10'
    ));
$result = $sock->fetch_body();

echo $result;

?>

index.php
HTML:
<form action="da_create_mail.php" method="post" name="form_mail_accounts" id="form_mail_accounts">
  <div align="center"></div>
  <table width="90%"  border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td colspan="3"><div align="center"><span class="style1">add</span></div></td>
    </tr>
    <tr>
   <td width="55%">user<input name="user" type="text" id="user" size="25" maxlength="12"></td>
      <td width="55%">pass<input name="passwd" type="text" id="passwd" size="25" maxlength="12"></td>
    </tr>
  </table>
  <div align="center"></div>
  <p align="center">
    <input type="submit" name="Submit" value="add">
    <input type="reset" name="Submit2" value="Reset Form">
</p>
</form>
 
PHP:
$sock->query('/CMD_API_POP','domain=$domain&quota='.$_POST['quota'].'&action=create&user='.$_POST['user'].'&passwd='.$_POST['passwd'].'');
///echo $sock->result;
if(eregi('error=0', $sock->result)){
 echo '<p>Email<br />
 username:    '.$_POST['user'].'@$domain<br />
 password:    '.$_POST['passwd'].'<br />
 Quota:        '.$_POST['quota'].'<br />
 POP3 server:    mail.$domain<br />
 SMTP server:    mail.$domain*</p>';
}
if(eregi('error=1', $sock->result)){
 echo 'error';
}
 
Back
Top