Ver Mensaje Individual
  #1 (permalink)  
Antiguo 01/01/2014, 13:04
anju_81
 
Fecha de Ingreso: junio-2008
Mensajes: 25
Antigüedad: 15 años, 11 meses
Puntos: 0
Insertar imágenes mediante Formulario

Buenas

Tengo un formulario en HTML, que me envía los datos a mi correo electrónico, para procesar el envío uso código en PHP (adjunto el HTML y el PHP)

Lo que quiero hacer es insertar la opción de adjuntar una imagen y que esta me llegue directamente al propio email que recibo cuando se rellena el formulario y le damos a enviar.

CODIGO HTML:
Código HTML:
Ver original
  1. <form method="post" name="contact" action="mailform.php">
  2.               <table width="396" border="0">
  3.                                   <tr>
  4.                                     <td>
  5.                                       <label for="author">Nombre:</label>
  6.                                     </td>
  7.                                     <td colspan="2"><input name="nombre" type="text" id="nombre" value="" size="30" /></td>
  8.                                  </tr>
  9.                                   <tr>
  10.                                     <td>
  11.                                       <label for="author">Dirección:</label>
  12.                                     </td>
  13.                                     <td colspan="2"><input name="direccion" type="text" id="direccion" value="" size="40" /></td>
  14.                                   </tr>
  15.                                   <tr>
  16.                                     <td>
  17.                                     <label for="author2">Población:</label>
  18.                                     </td>
  19.                                     <td colspan="2"><input name="poblacion" type="text" id="poblacion" value="" size="30" /></td>
  20.                                    </tr>
  21.                                   <tr>
  22.                                     <td>
  23.                                         <label for="author">Email:</label>
  24.                                     </td>
  25.                                     <td colspan="2"><input name="email" type="text" id="email" value="" size="30" /></td>
  26.                                   <tr>
  27.                                     <td><label for="author3">Teléfono:</label>
  28.                                     </td>
  29.                                     <td colspan="2"><input name="telefono" type="text" id="telefono" value="" size="15" /></td>
  30.                 </tr>
  31. <tr>
  32.                                       <td><label for="author4">Asunto:</label>
  33.                                     </td>
  34.                                       <td colspan="2"><input name="asunto" type="text" id="asunto" value="" size="30" /></td>
  35.                 </tr>
  36.                                   <tr>
  37.                                     <td colspan="3">
  38.                                     <label for="text2">Mensaje:</label></td>
  39.                                   </tr>
  40.               <tr>
  41.                 <td colspan="3">
  42.                 <textarea id="mensaje" name="mensaje" rows="9" cols="45" class="required"></textarea>
  43.                 </td>
  44.               </tr>
  45.                                 <tr>
  46.                                       <td colspan="3">&nbsp;</td>
  47.                                 </tr>
  48.              
  49.               <tr>
  50.                 <td width="80">
  51.                     <input type="submit" value="Enviar" id="enviar" name="enviar" class="submit_btn float_l" /></td>
  52.                 <td width="160">&nbsp;</td>
  53.                 <td width="161" align="left"><input type="reset" value="Borrar" id="reset" name="reset" class="submit_btn float_r" /></td>
  54.               </tr>
  55.               </table>
  56.             </form>

CODIGO PHP:

Código PHP:
Ver original
  1. $date = date("m/d/Y H:i:s");
  2.  
  3. if ($_SERVER['REMOTE_ADDR'] == "")
  4.     $ip = "no ip";
  5. else
  6.     $ip = getHostByAddr($_SERVER['REMOTE_ADDR']);
  7.  
  8.  
  9. if ($_POST['enviar'] != ""){  
  10.     // Mail al administrador...
  11.     $mail = new PHPMailer();
  12.     $mail->From     = $adminaddress;
  13.     $mail->FromName = $sitename;
  14.     $mail->AddAddress($adminaddress);
  15.     $mail->AddReplyTo($adminaddress);
  16.     $mail->IsHTML(false);                               // send as HTML
  17.     $mail->Subject  =  "Me gustaria tener informacion sobre: ".$_POST['asunto']." ";
  18.     $mail->Body  =  "Enviado desde la web:\n
  19. ------------------------------ 
  20. Nombre y Apellidos: ".$_POST['nombre']."
  21. Direccion: ".$_POST['direccion']."
  22. Poblacion: ".$_POST['poblacion']."
  23. E-Mail: ".$_POST['email']."
  24. Telefono: ".$_POST['telefono']."
  25. Asunto: ".$_POST['asunto']."
  26. Mensaje: ".$_POST['mensaje']."
  27. Enviado: ".$date;"
El código sigue con más opciones...

Muchas gracias por la ayuda

Última edición por pzin; 04/01/2014 a las 15:59 Razón: formato código