Jump to content
[MUST READ] Forum Rules ×

Script for creating email outside VistaPanel


Recommended Posts

Hello everyone, I'd like some help to create a form for creating an email from a page of my website, first of all, is it possible with VistaPanel? I've done that before with cPanel, but the authorization method is diferent in VistaPanel, and I can't connect the script I've got with VP. Can someone help me? Thanks!

Link to comment
Share on other sites

11 hours ago, Frajola said:

Hello everyone, I'd like some help to create a form for creating an email from a page of my website, first of all, is it possible with VistaPanel? I've done that before with cPanel, but the authorization method is diferent in VistaPanel, and I can't connect the script I've got with VP. Can someone help me? Thanks!

Do you mean a " email account " or just a " email message " ?

Link to comment
Share on other sites

30 minutes ago, Frajola said:

email account

I've never done such thing. But i believe it could be done ( although it wouldn't be easy, neither " clean " ).

I will try to create some scrypt for that, but I'm really busy with Project Aurora right now.

Link to comment
Share on other sites

1 hour ago, Aqib said:

So, you like to create a website like gmail or other free email account providers?

Right?

Almost, I just want to integrate this function to a Website I'm working on, it wouldn't be tottaly oppened to the public.

58 minutes ago, mike said:

I've never done such thing. But i believe it could be done ( although it wouldn't be easy, neither " clean " ).

I will try to create some scrypt for that, but I'm really busy with Project Aurora right now.

That's ok, I'm trying to work in a solution as well, but no success so far, I appreciate the effort.

Link to comment
Share on other sites

This is the code I've used with cPanel

this is the create.php

<?php

function pop3create($email,$senha,$quota) {
   $host = "localhost";
   $logincpanel="PANEL USER"; // cPanel Login
   $senhacpanel="PANEL PASSWORD"; // cPanel Password

   $socket = fsockopen($host,2082);
   socket_set_timeout($socket,30);

   $authstr = "$logincpanel:$senhacpanel";
   $pass = base64_encode($authstr);
   $in = "GET / HTTP/1.0\r\nAuthorization: Basic $pass \r\n\r\n";

   fputs($socket,$in);
   $resposta=array();
   while (!feof($socket)) {
       $resposta[] = htmlspecialchars(fgets($socket, 128));
   }
   fclose( $socket );

   $checa = strpos($resposta[6],"The Document has moved here");
   if ($checa != false) {
       //if logged successfully
       $redir = trim(str_replace("Location: ","",$resposta[3]));
       $redir = str_replace(substr($redir,-10),"mailcentral/doaddpop.html",$redir);
       $socket = fsockopen($host,2082);
       socket_set_timeout($socket,30);

       $split = split("@",$email);
       $loginemail = $split[0];
       $dominioemail = $split[1];

       $in = "GET $redir?email=$loginemail&domain=$dominioemail&password=$senha&quota=$quota HTTP/1.0\r\nAuthorization: Basic $pass \r\n\r\n";

       fputs($socket,$in);
       while (!feof($socket)) {
           $resto .= htmlspecialchars(fgets($socket, 128));
       }
       fclose( $socket );

       $parametro = $loginemail."+".$dominioemail;
       $checa = strpos($resto,$parametro);
       if ($checa != false) {
           return 1;
       }
       else {
           return 2;
       }
   }
   else {
       echo "cPanel connection refused";
   }
}


$criaconta = pop3create("$loginemail@$dominioemail","$senha","$quota");
if ($criaconta == 1) {
   echo "Success...<br><br>your email is: $loginemail@$dominioemail";
}
if ($criaconta == 2) {
   echo "Account already exists";
}
?>

and this is the form code

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Criando seu e-mail!</title>
<style type="text/css">
<!--
.style1 {
    font-family: Verdana;
    font-size: 12px;
}
.style11 {font-family: Verdana; font-size: 10px; }
.style12 {font-size: 10px}
-->
</style>
</head>

<body>
<table width="500" align="center">
  <tr>
    <td align="center" valign="middle"><span class="style1">Create email</span></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td><form name="form1" method="post" action="create.php"><table width="500">
        <tr>
          <td><span class="style12"></span></td>
          <td><span class="style12"></span></td>
        </tr>
        <tr>
          <td><span class="style11">Login:</span></td>
          <td>
            <input name="loginemail" type="text" id="loginemail">
          </td>
        </tr>
        <tr>
          <td><span class="style11">Senha:</span></td>
          <td><input name="senha" type="text" id="senha"></td>
        </tr>
        <tr>
          <td><span class="style12"></span></td>
          <td><span class="style11">
            <input name="dominioemail" type="hidden" id="dominioemail" value="domain.here"><!-- COLOQUE AQUI O SEU DOMINIO -->
            <input name="quota" type="hidden" id="quota" value="5">
          </span></td>
        </tr>
        <tr>
          <td><span class="style12"></span></td>
          <td><input name="Submit" type="submit" value="Enviar!"></td>
        </tr>
        <tr>
          <td><span class="style12"></span></td>
          <td><span class="style12"></span></td>
        </tr>
    </table></form></td>
  </tr>
</table>

</body>
</html>

 

Link to comment
Share on other sites

9 hours ago, Frajola said:

This is the code I've used with cPanel

this is the create.php


<?php

function pop3create($email,$senha,$quota) {
   $host = "localhost";
   $logincpanel="PANEL USER"; // cPanel Login
   $senhacpanel="PANEL PASSWORD"; // cPanel Password

   $socket = fsockopen($host,2082);
   socket_set_timeout($socket,30);

   $authstr = "$logincpanel:$senhacpanel";
   $pass = base64_encode($authstr);
   $in = "GET / HTTP/1.0\r\nAuthorization: Basic $pass \r\n\r\n";

   fputs($socket,$in);
   $resposta=array();
   while (!feof($socket)) {
       $resposta[] = htmlspecialchars(fgets($socket, 128));
   }
   fclose( $socket );

   $checa = strpos($resposta[6],"The Document has moved here");
   if ($checa != false) {
       //if logged successfully
       $redir = trim(str_replace("Location: ","",$resposta[3]));
       $redir = str_replace(substr($redir,-10),"mailcentral/doaddpop.html",$redir);
       $socket = fsockopen($host,2082);
       socket_set_timeout($socket,30);

       $split = split("@",$email);
       $loginemail = $split[0];
       $dominioemail = $split[1];

       $in = "GET $redir?email=$loginemail&domain=$dominioemail&password=$senha&quota=$quota HTTP/1.0\r\nAuthorization: Basic $pass \r\n\r\n";

       fputs($socket,$in);
       while (!feof($socket)) {
           $resto .= htmlspecialchars(fgets($socket, 128));
       }
       fclose( $socket );

       $parametro = $loginemail."+".$dominioemail;
       $checa = strpos($resto,$parametro);
       if ($checa != false) {
           return 1;
       }
       else {
           return 2;
       }
   }
   else {
       echo "cPanel connection refused";
   }
}


$criaconta = pop3create("$loginemail@$dominioemail","$senha","$quota");
if ($criaconta == 1) {
   echo "Success...<br><br>your email is: $loginemail@$dominioemail";
}
if ($criaconta == 2) {
   echo "Account already exists";
}
?>

and this is the form code


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Criando seu e-mail!</title>
<style type="text/css">
<!--
.style1 {
    font-family: Verdana;
    font-size: 12px;
}
.style11 {font-family: Verdana; font-size: 10px; }
.style12 {font-size: 10px}
-->
</style>
</head>

<body>
<table width="500" align="center">
  <tr>
    <td align="center" valign="middle"><span class="style1">Create email</span></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td><form name="form1" method="post" action="create.php"><table width="500">
        <tr>
          <td><span class="style12"></span></td>
          <td><span class="style12"></span></td>
        </tr>
        <tr>
          <td><span class="style11">Login:</span></td>
          <td>
            <input name="loginemail" type="text" id="loginemail">
          </td>
        </tr>
        <tr>
          <td><span class="style11">Senha:</span></td>
          <td><input name="senha" type="text" id="senha"></td>
        </tr>
        <tr>
          <td><span class="style12"></span></td>
          <td><span class="style11">
            <input name="dominioemail" type="hidden" id="dominioemail" value="domain.here"><!-- COLOQUE AQUI O SEU DOMINIO -->
            <input name="quota" type="hidden" id="quota" value="5">
          </span></td>
        </tr>
        <tr>
          <td><span class="style12"></span></td>
          <td><input name="Submit" type="submit" value="Enviar!"></td>
        </tr>
        <tr>
          <td><span class="style12"></span></td>
          <td><span class="style12"></span></td>
        </tr>
    </table></form></td>
  </tr>
</table>

</body>
</html>

 

For what i can see, you are using " POP " to create the accounts, right ?

Note that if so, and as for as im aware, neither POP, nor SMTP are enabled on free hosting.

Link to comment
Share on other sites

10 hours ago, mike said:

For what i can see, you are using " POP " to create the accounts, right ?

Note that if so, and as for as im aware, neither POP, nor SMTP are enabled on free hosting.

Yeah, it uses POP, if its not enabled is there any method to authenticate to VistaPanel through my website? Because if so I might be able to do something, but I don't believe it is possible, because accessing through the IP adress to the panel: https://185.27.134.3/ , it doesn't allow to login, just returns the error: "It appears you are accessing the panel from an invalid address".

Thanks everyone for trying to help, I believe its easier to continue creating the email accounts mannually haha.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...