Ver Mensaje Individual
  #5 (permalink)  
Antiguo 07/01/2009, 09:03
MAURIXIO5540
 
Fecha de Ingreso: noviembre-2008
Mensajes: 55
Antigüedad: 16 años, 4 meses
Puntos: 0
Respuesta: Ayuda con PHP Mailer y adjuntos.

Espero esto te pueda ayudar... En el body...este codigo
Código php:
Ver original
  1. <body>
  2. <form id="form1" name="form1" method="get" action="upload.php" enctype="multipart/form-data">
  3.   <table width="80%" border="0" align="center">
  4.     <tr>
  5.       <td width="22%">Nombre</td>
  6.       <td width="78%"><label>
  7.         <input name="txNom" type="text" id="txNom" />
  8.       </label></td>
  9.     </tr>
  10.     <tr>
  11.       <td>Apellido</td>
  12.       <td><input name="txApe" type="text" id="txApe" /></td>
  13.     </tr>
  14.     <tr>
  15.       <td>Direcci&oacute;n</td>
  16.       <td><input name="txDir" type="text" id="txDir" /></td>
  17.     </tr>
  18.     <tr>
  19.       <td>Tel&eacute;fono</td>
  20.       <td><input name="txTel" type="text" id="txTel" /></td>
  21.     </tr>
  22.     <tr>
  23.       <td>E-mail</td>
  24.       <td><input name="txMai" type="text" id="txMai" /></td>
  25.     </tr>
  26.     <tr>
  27.       <td colspan="2"><label>
  28.         <input type="submit" name="Submit" value="Enviar" />
  29.       </label></td>
  30.     </tr>
  31.   </table>
  32. </form>
  33. </body>

y upload.php... este codigo

Código php:
Ver original
  1. <?php
  2. require_once 'class.phpmailer.php';
  3. $nombre=$_GET['txNom'];
  4. $apellido=$_GET['txApe'];
  5. $direccion=$_GET['txDir'];
  6. $telefono=$_GET['txTel'];
  7. $correo=$_GET['txMai'];
  8. $mail = new PHPMailer ();
  9.  
  10. $mail -> From = "Prueba";
  11. $mail -> FromName = "Prueba";
  12. $mail -> AddAddress = "aqui la direccion mail del destinatario";
  13. $mail -> Subject = "Envio datos";
  14. $mail -> Body = "<p>Nombre: <h3>".$nombre."</h3></p><p>Apellido: <h3>".$apellido."</h3></p><p>Dirección: <h3>".$direccion."</h3></p><p>Teléfono: <h3>".$telefono."</h3></p><p>Correo: <h3>".$correo."</h3></p>";
  15. $mail -> IsHTML (true);
  16.  
  17. $mail->IsSMTP();
  18. $mail->Host = 'ssl://smtp.gmail.com';
  19. $mail->Port = 465;
  20. $mail->SMTPAuth = true;
  21. $mail->Username = 'aqui la cuenta gmail';
  22. $mail->Password = 'aqui la contraseña de la cuenta gmail';
  23.  
  24. if(!$mail->Send()) {
  25.     echo "Envio exitoso";
  26. }
  27. else
  28. {   echo "No se pudo enviar";
  29. }
  30.  
  31. ?>