Frajola Posted April 30, 2018 Share Posted April 30, 2018 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! Quote Link to comment Share on other sites More sharing options...
mike Posted May 1, 2018 Share Posted May 1, 2018 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 " ? Quote Link to comment Share on other sites More sharing options...
Frajola Posted May 1, 2018 Author Share Posted May 1, 2018 email account Quote Link to comment Share on other sites More sharing options...
AA22Dev Posted May 1, 2018 Share Posted May 1, 2018 7 minutes ago, Frajola said: email account So, you like to create a website like gmail or other free email account providers? Right? Quote Link to comment Share on other sites More sharing options...
mike Posted May 1, 2018 Share Posted May 1, 2018 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. Quote Link to comment Share on other sites More sharing options...
Frajola Posted May 1, 2018 Author Share Posted May 1, 2018 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. Quote Link to comment Share on other sites More sharing options...
Frajola Posted May 1, 2018 Author Share Posted May 1, 2018 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"a=$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> </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> Quote Link to comment Share on other sites More sharing options...
mike Posted May 2, 2018 Share Posted May 2, 2018 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"a=$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> </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. Quote Link to comment Share on other sites More sharing options...
Frajola Posted May 2, 2018 Author Share Posted May 2, 2018 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.