Foros del Web » Programando para Internet » PHP »

Envio de Email al que lleno los datos

Estas en el tema de Envio de Email al que lleno los datos en el foro de PHP en Foros del Web. Ayudenme por favor necesito enviar un mail a la persona que lleno un formulario hay un input que la persona da su email pero aparte ...
  #1 (permalink)  
Antiguo 24/09/2011, 17:00
Usuario no validado
 
Fecha de Ingreso: junio-2011
Ubicación: Colombia
Mensajes: 15
Antigüedad: 12 años, 10 meses
Puntos: 0
Pregunta Envio de Email al que lleno los datos

Ayudenme por favor necesito enviar un mail a la persona que lleno un formulario hay un input que la persona da su email pero aparte de eso que se inserte en la base de datos mysql ya esto lo logre yo inserto los datos pero no he logrado que le llegue el e-mail.....les pongo el código.......

Código PHP:
<?php require_once('../../../Connections/peticiones.php'); 
session_start();
?>
<?php
if (!function_exists("GetSQLValueString")) {
function 
GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  if (
PHP_VERSION 6) {
    
$theValue get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  
$theValue function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch (
$theType) {
    case 
"text":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;    
    case 
"long":
    case 
"int":
      
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case 
"double":
      
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case 
"date":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;
    case 
"defined":
      
$theValue = ($theValue != "") ? $theDefinedValue $theNotDefinedValue;
      break;
  }
  return 
$theValue;
}
}

$editFormAction $_SERVER['PHP_SELF'];
if (isset(
$_SERVER['QUERY_STRING'])) {
  
$editFormAction .= "?" htmlentities($_SERVER['QUERY_STRING']);
}

$editFormAction $_SERVER['PHP_SELF'];
if (isset(
$_SERVER['QUERY_STRING'])) {
  
$editFormAction .= "?" htmlentities($_SERVER['QUERY_STRING']);

if ((isset(
$_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  
$insertSQL sprintf("INSERT INTO messages (pray_nombre, pray_apellido, pray_email, pray_telefono, pray_titulo, pray_peticion) VALUES (%s, %s, %s, %s, %s, %s)",
                       
GetSQLValueString($_POST['pray_nombre'], "text"),
                       
GetSQLValueString($_POST['pray_apellido'], "text"),
                       
GetSQLValueString($_POST['pray_email'], "text"),
                       
GetSQLValueString($_POST['pray_telefono'], "text"),
                       
GetSQLValueString($_POST['pray_titulo'], "text"),
                       
GetSQLValueString($_POST['pray_peticion'], "text"));

  
mysql_select_db($database_peticiones$peticiones);
  
$Result1 mysql_query($insertSQL$peticiones) or die(mysql_error());

  
$insertGoTo "peticiones.php";
  if (isset(
$_SERVER['QUERY_STRING'])) {
    
$insertGoTo .= (strpos($insertGoTo'?')) ? "&" "?";
    
$insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  
header(sprintf("Location: %s"$insertGoTo));
}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Centro de Fe y Esperanza Robledo</title>
<link rel="stylesheet" href="../../../css/iglesia/oracion/peticiones.css" type="text/css" media="screen"/>
<link rel="stylesheet" href="../../../css/iglesia/nav.css" type="text/css" media="screen"/>
<link rel="stylesheet" href="../../../css/iglesia/reset.css" type="text/css" media="screen"/>

<link href='http://fonts.googleapis.com/css?family=Raleway:100' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Oswald&v1' rel='stylesheet' type='text/css'>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.2.min.js"></script>
<!--script para limitar caracteres en textarea-->

</head>

<body onLoad="limpiar();">
<div id="top_header_oracion">
<div class="nav_oracion">
<ul>
            <li><a href="../../../index.html">inicio</a></li>
            <li><a href="../../../html/iglesia/soynuevo.html">¿eres nuevo?</a></li>
            <li><a href="../../../html/iglesia/conectate.html">conectate</a></li>
            <li><a href="peticiones.php">oración</a></li>
            <li><a href="../recursos/recursos.php">recursos</a></li>
            <li><a href="../contacto/contacto.php">contacto</a></li>
    </ul>
</div><!--final nav_index-->
</div><!--final top_header_oracion-->
<div class="back_contenido1"></div>
<div class="contenido1">
<div class="peticiones_box1">
        <div class="peticiones_box_title"><p>peticiones |</p></div>
        <div class="peticiones_box_subtitle"><img src="../../../img/iglesia/oracion/peticiones/pray_personal.jpg" /></div>
        
    </div><!--final peticiones_box-->

    <div class="peticiones_box2">
      <form action="<?php echo $editFormAction?>" method="POST" name="form1" id="form1">
        <div class="panel_secundario_title">Nombre:</div>
        <div class="panel_secundario_title">Apellido:</div>
            <div class="panel_secundario"><input type="text" name="pray_nombre" value="" size="32" /></div>
            <div class="panel_secundario"><input type="text" name="pray_apellido" value="" size="32" /></div>
        <div class="panel_secundario_title">e-mail:</div>
        <div class="panel_secundario_title">Teléfono:</div>
            <div class="panel_secundario"><input type="text" name="pray_email" value="" size="32" /></div>            
            <div class="panel_secundario"><input type="text" name="pray_telefono" value="" size="32" /></div>
        <div class="panel_secundario_title" style="text-align:right;padding-top:15px;">Título de la Petición:</div>
            <div class="panel_secundario"><input type="text" name="pray_titulo" value="" size="32"  /></div>  
        <div class="panel_textarea_title">Petición o Necesidad:</div>
        <div id="limit"></div>
            <div class="panel_textarea"><textarea name="pray_peticion" cols="67" rows="12"></textarea></div> 
            <input type="submit" value="ENVIAR" class="panel_boton"/>
             
        <input type="hidden" name="MM_insert" value="form1" />
      </form>
      <p>&nbsp;</p>
    </div>
</div><!--final contenedor-->

<div class="back_contenido2"></div>

<script type="text/javascript" src="../../../js/iglesia/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="../../../js/iglesia/limit_caracter.js"></script>
<script type="text/javascript"> 
    $(document).ready(function(){
        $('textarea').limit('1000','#limit');
    });
</script>
</body>
</html>
cuando le doy enviar pasa a la página donde estan los datos que puso el usuario,.....ah algo importante es que no manejo login asi que los datos son los que pone el usuario en el formulario solamente.........muchas gracias por su ayuda
  #2 (permalink)  
Antiguo 24/09/2011, 18:58
Avatar de Ronruby  
Fecha de Ingreso: julio-2008
Ubicación: 18°30'N, 69°59'W
Mensajes: 4.879
Antigüedad: 15 años, 9 meses
Puntos: 416
Respuesta: Envio de Email al que lleno los datos

No veo el codigo para el envío del correo en ese script.
  #3 (permalink)  
Antiguo 24/09/2011, 19:06
Usuario no validado
 
Fecha de Ingreso: junio-2011
Ubicación: Colombia
Mensajes: 15
Antigüedad: 12 años, 10 meses
Puntos: 0
Pregunta Respuesta: Envio de Email al que lleno los datos

Perdón no lo puse..........
como ves el de arriba es el del formulario y donde se insertan los datos a mysql y aquí es donde aparecen los datos que pusieron en el formulario:::::

Código PHP:
<?php require_once('../../../Connections/peticiones.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function 
GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  if (
PHP_VERSION 6) {
    
$theValue get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  
$theValue function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch (
$theType) {
    case 
"text":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;    
    case 
"long":
    case 
"int":
      
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case 
"double":
      
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case 
"date":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;
    case 
"defined":
      
$theValue = ($theValue != "") ? $theDefinedValue $theNotDefinedValue;
      break;
  }
  return 
$theValue;
}
}

$maxRows_peticiones_consultas 20;
$pageNum_peticiones_consultas 0;
if (isset(
$_GET['pageNum_peticiones_consultas'])) {
  
$pageNum_peticiones_consultas $_GET['pageNum_peticiones_consultas'];
}
$startRow_peticiones_consultas $pageNum_peticiones_consultas $maxRows_peticiones_consultas;

mysql_select_db($database_peticiones$peticiones);
$query_peticiones_consultas "SELECT * FROM messages ORDER BY mes_id DESC";
$query_limit_peticiones_consultas sprintf("%s LIMIT %d, %d"$query_peticiones_consultas$startRow_peticiones_consultas$maxRows_peticiones_consultas);
$peticiones_consultas mysql_query($query_limit_peticiones_consultas$peticiones) or die(mysql_error());
$row_peticiones_consultas mysql_fetch_assoc($peticiones_consultas);

if (isset(
$_GET['totalRows_peticiones_consultas'])) {
  
$totalRows_peticiones_consultas $_GET['totalRows_peticiones_consultas'];
} else {
  
$all_peticiones_consultas mysql_query($query_peticiones_consultas);
  
$totalRows_peticiones_consultas mysql_num_rows($all_peticiones_consultas);
}
$totalPages_peticiones_consultas ceil($totalRows_peticiones_consultas/$maxRows_peticiones_consultas)-1;




?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Centro de Fe y Esperanza Robledo</title>
<link rel="stylesheet" href="../../../css/iglesia/oracion/intersesores.css" type="text/css" media="screen"/>
<link rel="stylesheet" href="../../../css/iglesia/nav.css" type="text/css" media="screen"/>
<link rel="stylesheet" href="../../../css/iglesia/reset.css" type="text/css" media="screen"/>
<link type='text/css' href='css/basic.css' rel='stylesheet' media='screen' />

<link href='http://fonts.googleapis.com/css?family=Raleway:100' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Oswald&v1' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Open+Sans+Condensed:300' rel='stylesheet' type='text/css'>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(function() {

$(".vote").click(function() 
{

var id = $(this).attr("id");
var name = $(this).attr("name");
var dataString = 'id='+ id ;
var parent = $(this);


if(name=='up')
{

$(this).fadeIn(200).html('<img src="dot.png" align="absmiddle">');
$.ajax({
   type: "POST",
   url: "up_vote.php",
   data: dataString,
   cache: false,

   success: function(html)
   {
    parent.html(html);
  
  }  });
  
}
else
{

$(this).fadeIn(200).html('<img src="dot.png" align="absmiddle">');
$.ajax({
   type: "POST",
   url: "down_vote.php",
   data: dataString,
   cache: false,

   success: function(html)
   {
       parent.html(html);
  }
   
 });


}
  
  
   
 

return false;
    });

});
</script>

</head>

<body>
<div id="top_header_oracion">
<div class="nav_oracion">
<ul>
            <li><a href="../../../index.html">inicio</a></li>
            <li><a href="../../../html/iglesia/soynuevo.html">¿eres nuevo?</a></li>
            <li><a href="../../../html/iglesia/conectate.html">conectate</a></li>
            <li><a href="#">oración</a></li>
            <li><a href="../recursos/recursos.php">recursos</a></li>
            <li><a href="../contacto/contacto.php">contacto</a></li>
       </ul>
</div><!--final nav_index-->
</div><!--final top_header_oracion-->
<div class="back_contenido1"></div>
<div class="contenido1">

<div class="need_panel_title">
  <div class="need_panel_title_top">Peticiones de oración</div>
      <div class="need_panel_title_side"><a href="form_peticiones.php"><p> | nueva petición</p></a></div>
      
</div><!--final need_panel_title-->
<div class="need_panel_space"></div>  
<?php do { ?>

<div class="need_panel_titulo_pray"><p> <?php echo $row_peticiones_consultas['pray_titulo']; ?>...</p></div>


<div class="need_panel_pray">
    <div class="need_panel1_peticion">
        <blockquote><p><?php echo $row_peticiones_consultas['pray_peticion']; ?>...</p></blockquote>
    </div><!--final need_panel1-->            
</div><!--final need_panel1-->
<form action="envio.php" name="form_conteo">
<div class="need_panel_datos">
    <!--<div class="need_panel1_peticion_orar"><a href="intersesores_espiritual.php"><p>orar por esta necesidad</p></a></div>-->

    <input type="hidden" name="conteo_oracion"/><div class="need_panel1_peticion_orar"><div class='up'><a href="" class="vote" id="<?php echo $row_peticiones_consultas['mes_id']; ?>" name="up">Clic para orar | &nbsp;<?php echo $row_peticiones_consultas['up']; ?></a></div></div>
    <div class="need_panel1_peticion_cantidad"><p> veces oraron por tí</p></div>
    <div class="need_panel1_peticion_autor"><p>| <?php echo $row_peticiones_consultas['pray_nombre']; ?> <?php echo $row_peticiones_consultas['pray_apellido']; ?></p></div>
    <div class="need_panel1_peticion_fecha"><p>| <?php echo $row_peticiones_consultas['pray_fecha']; ?></p></div>
</div><!--final need_panle_datos-->
</form>
<?php } while ($row_peticiones_consultas mysql_fetch_assoc($peticiones_consultas)); ?>

         
</div><!--final contenido1-->
<div class="back_contenido2"></div>
<div class="contenido2">
</div><!--final contenido2-->
</body>
</html>
<?php
mysql_free_result
($peticiones_consultas);
?>

bien entonces la pregunta persiste ¿cómo hago para, aparte de insertar los datos, enviarle un correo al que lleno el formulario? y si notas allí en el formulario hay un input que dice email y es alli en la única parte que obtengo ese dato del usuario ya que no se va a manejar login..........Agradezco tu ayuda.........
  #4 (permalink)  
Antiguo 27/09/2011, 02:08
Usuario no validado
 
Fecha de Ingreso: junio-2011
Ubicación: Colombia
Mensajes: 15
Antigüedad: 12 años, 10 meses
Puntos: 0
Respuesta: Envio de Email al que lleno los datos

A pesar que no me ayudaron en nada quisiera ayudar a los que esten en esta........YA LO LOGRE WEEEEEEEE...........bueno aqui dejo el código solo ponlo en la página que tienes el formulario y cambia los datos por los que pusistes en el "name" de tus "input" y listo funciona...........weeeeeeeeeeee

Código PHP:
Ver original
  1. <?php
  2. if(isset($_POST['enviar'])) //Preguntamos si se presiono el boton de submit
  3. {
  4.      //Recibimos las variables
  5.      $recipiente = $_POST['pray_email'];
  6.      $asunto = $_POST['pray_titulo'];
  7.      $mensaje = $_POST['pray_peticion'];
  8.  
  9.      $encabezado = 'MIME-Version: 1.0' . "\r\n";
  10.      $encabezado .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
  11.      $encabezado .= 'From: Yo (pones lo que quiera seria como el asunto <cualquier [email protected]>' . "\r\n";
  12.  
  13.      // (substr_count) cuenta dentro de la frase o palabra almacenada en la variable si, existe '@' solo debe haber uno.
  14.      // se le pone @ adelante del substr_count para ignorar los errores.
  15.  
  16.      if(@substr_count($recipiente,'@') == 1){ // Validacion de correo escrito correctamente
  17.           if($asunto == '' or $mensaje == '' or  $recipiente == '' ) // Validacion de campos sin rellenar
  18.           {
  19.                echo '<strong>Campos vacios, por favor llene los campos</strong>';
  20.           }
  21.           else
  22.           {
  23.                mail($recipiente, $asunto, $mensaje, $encabezado);
  24.                echo "<strong>Se envio correctamente</strong>";
  25.           }
  26.      }
  27.      else
  28.      {
  29.           echo "<strong>Email es incorrecto</strong>";
  30.      }
  31. }
  32. ?>


Bueno espero sirva de algo y cualquier duda me avisan

Etiquetas: correo, electronico, email, mailphp
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 15:58.