PHP problema enviando un correo electrónico - por favor ayuda

  • bluegene
  • Born
  • Born
  • No Avatar
  • Registrado: Jul 18, 2012
  • Mensajes: 2
  • Status: Offline

Nota Enero 28th, 2013, 10:27 pm

¿hola alguien por favor me puede ayudar con un envío de correo electrónico cuestión?

Ive consiguió un campo de entrada con el nombre "dirección de correo electrónico de tus amigos" cuando el usuario rellena el formulario que tiene que poner su email de amigos en ese campo y, a continuación, al presentar el formulario de correo electrónico va a su amigo, así que mi problema es......¿Cómo lo hago? POR FAVOR AYUDA!!!
  • Anonymous
  • Bot
  • No Avatar
  • Registrado: 25 Feb 2008
  • Mensajes: ?
  • Loc: Ozzuland
  • Status: Online

Nota Enero 28th, 2013, 10:27 pm

  • Zealous
  • Guru
  • Guru
  • Avatar de Usuario
  • Registrado: Abr 15, 2011
  • Mensajes: 1194
  • Loc: Sydney
  • Status: Offline

Nota Enero 29th, 2013, 1:48 am

donde es el código en código bb, pero cualquiera de los 10.000 tutoriales ahi deben darle el diseño de qué hacer.
  • ScottG
  • Proficient
  • Proficient
  • No Avatar
  • Registrado: Jul 06, 2010
  • Mensajes: 260
  • Status: Offline

Nota Enero 29th, 2013, 8:25 am

Si se realiza una búsqueda simple en Google "php simple mailer" hay varias maneras de ir sobre esto y muchos tutoriales como entusiasta declarado. Para arrojar un poco de luz sobre lo va a necesitar hacer uso de la función de correo en PHP. Al enviar el formulario con su correo electrónico de amigos la página que se establece en el atributo action de la etiqueta de formulario tendrá que obtener el correo electrónico por uso del $_POST o $_GET variable dependiendo de cómo configurar el formulario. Después de esa información puede hacer el asunto y el mensaje que se enviará a su amigo. También puede agregar campos al formulario para el asunto y mensaje y capturarlos en la misma manera que el correo electrónico. Una vez que tienes el correo electrónico, asunto y el mensaje puede configurar los encabezados aunque no son necesarios.

Mire el ejemplo de abajo

Form.php
HTML Código: [ Select ]
<!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>Form Mailer</title>
</head>
 
<body>
<form id="form1" name="form1" method="post" action="form_mailer.php">
<table width="455" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="45" align="center"><label for="email">friends email</label></td>
    <td><input name="email" type="text" id="email" size="30" /></td>
  </tr>
  <tr>
    <td height="38">&nbsp;</td>
    <td><label>
      <input type="submit" name="Submit" id="Submit" value="Submit" />
    </label></td>
  </tr>
</table>
</form>
</body>
</html>
 
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>Form Mailer</title>
  6. </head>
  7.  
  8. <body>
  9. <form id="form1" name="form1" method="post" action="form_mailer.php">
  10. <table width="455" border="0" cellspacing="0" cellpadding="0">
  11.   <tr>
  12.     <td height="45" align="center"><label for="email">friends email</label></td>
  13.     <td><input name="email" type="text" id="email" size="30" /></td>
  14.   </tr>
  15.   <tr>
  16.     <td height="38">&nbsp;</td>
  17.     <td><label>
  18.       <input type="submit" name="Submit" id="Submit" value="Submit" />
  19.     </label></td>
  20.   </tr>
  21. </table>
  22. </form>
  23. </body>
  24. </html>
  25.  


form_mailer.php
PHP Código: [ Select ]
<?php
 
// Get the email from the post info
$friends_email = $_POST['email'];
 
// Make the subject and the message
$subject = 'This is a test message';
$message = 'This is the body of the message to be sent to the friends email';
 
// This takes the email and displays it as who this email is from.
$headers = "From: Someone@Somthing.com\r\n";
 
// This tells the server to turn the coding into the text.
$headers .= "Content-type: text/html\r\n";
 
// This tells the server what to send.
if(mail($friends_email, $subject, $message, $headers)) {
   
   // Kick to success page
   header("location: it_worked.php");
   
} else {
   
   // Kick to error page
   header("location: boo_it_failed.php");
   
}
 
 
?>
 
  1. <?php
  2.  
  3. // Get the email from the post info
  4. $friends_email = $_POST['email'];
  5.  
  6. // Make the subject and the message
  7. $subject = 'This is a test message';
  8. $message = 'This is the body of the message to be sent to the friends email';
  9.  
  10. // This takes the email and displays it as who this email is from.
  11. $headers = "From: Someone@Somthing.com\r\n";
  12.  
  13. // This tells the server to turn the coding into the text.
  14. $headers .= "Content-type: text/html\r\n";
  15.  
  16. // This tells the server what to send.
  17. if(mail($friends_email, $subject, $message, $headers)) {
  18.    
  19.    // Kick to success page
  20.    header("location: it_worked.php");
  21.    
  22. } else {
  23.    
  24.    // Kick to error page
  25.    header("location: boo_it_failed.php");
  26.    
  27. }
  28.  
  29.  
  30. ?>
  31.  

Publicar Información

  • Total de mensajes en este tema: 3 mensajes
  • Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 176 invitados
  • No puede abrir nuevos temas en este Foro
  • No puede responder a temas en este Foro
  • No puede editar sus mensajes en este Foro
  • No puede borrar sus mensajes en este Foro
  • No puede enviar adjuntos en este Foro
 
 

© 2011 Unmelted, LLC. Ozzu® es una marca registrada de Unmelted, LLC