McBlink Posted March 25, 2007 Share Posted March 25, 2007 Hello, i'm argentian and i don't speak english very well, but well, i have a problem. i desire send mail to the new user than he register in my web. i have 2 codes. 1 is registra.php that one is in charge to verify fields and to register the new user, and other that sends a mail to the user, but this I complete not where to place it within registrar.php. the code of registra.php is the next: <? include('config.php'); //incluimos el config.php que contiene los datos de la conexión a la db //Inicias la sesión session_name('sesion_site'); session_start(); //Comprobamos que los campos nick, pass y pass1 se han rellenado en el form de reg.php, sino volvemos al form if(($_POST[nick] == ' ') or ($_POST[pass] == ' ') or ($_POST[pass1] == ' ') ) { Header("Location: reg.php"); //enviamos al form de registro que esta en reg.php }else{ //Comprobamos que la pass y pass1 son iguales, sino, volvemos a reg.php if($_POST[pass] != $_POST[pass1]) { echo 'Las passwords no son iguales'; }else{ //quitamos el codigo malicioso de $_POST[nick] y $_POST[pass] $user = stripslashes($_POST["nick"]); $user = strip_tags($user); $pass = stripslashes($_POST["pass"]); $pass = strip_tags($pass); //comprobamos que el usuario no existe en la db $usuarios=mysql_query("SELECT nick FROM user WHERE nick='$user' "); if($user_ok=mysql_fetch_array($usuarios)) { echo 'El usuario ya esta registrado'; mysql_free_result($usuarios); //liberamos la memoria del query a la db }else{ //quitamos todo el codigo malicioso de las demas variables del form de registro $email = stripslashes($_POST["email"]); $email = strip_tags($email); $pj = stripslashes($_POST["pj"]); $pj = strip_tags($pj); $rollo = stripslashes($_POST["rollo"]); $rollo = strip_tags($rollo); $rollo = str_replace("\n\r","<br>",$rollo); //se cambian los saltos de linea por <br> $rollo = str_replace("\r\n","<br>",$rollo); $rollo = str_replace("\n","<br>",$rollo); $fecha = time(); $level = "2"; //usaremos level 1 para admins, level 2 para los demas (se cambia manualmente desde phpmyadmin) //introducimos el nuevo registro en la tabla users $_SESSION['formulario'] = $_POST; mysql_query("INSERT INTO user (nick,pass,email,fecha,level,rollo,pj) values ('$user','$pass','$email','$fecha','$level','$rollo','$pj') "); echo 'Usuario registrado con éxito.'; echo 'redireccionando al Home'; echo '<meta http-equiv="Refresh" content="1;URL=login.php">'; } } } ?> and the code to send email is this: (but i not if he is correct) <? $remitente = $_REQUEST["email"]; $destino= "xxxxxxxxxxx@hotmail.com"; $asunto= "Este es un mensaje de felicitacion"; $mensaje= "América y ya<p>Nos vamos a la Libertadores<p><b>América para los americanistas</b>"; $encabezados = "From: $remitente\nReply-To: $remitente\nContent-Type: text/html; charset=iso-8859-1"; mail($destino, $asunto, $mensaje, $encabezados) or die ("Su mensaje no se envio."); ?> Well, i'm sorry for my bad english, can you understand the topic? xD greetings from Argentinean!! Bye! Quote Link to comment https://forums.phpfreaks.com/topic/44231-users-register-and-send-mail-with-the-account-info/ Share on other sites More sharing options...
cmgmyr Posted March 25, 2007 Share Posted March 25, 2007 - So is it not sending an e-mail? - Did it give you an error? - What would you like it to do that it's not? You might want to check in your "Junk" folder in your e-mail...it might be there. Quote Link to comment https://forums.phpfreaks.com/topic/44231-users-register-and-send-mail-with-the-account-info/#findComment-214806 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.