Ver Mensaje Individual
  #1 (permalink)  
Antiguo 28/05/2012, 01:56
chuntaro18
 
Fecha de Ingreso: mayo-2012
Ubicación: Distrito Federal
Mensajes: 49
Antigüedad: 12 años
Puntos: 9
Pregunta Pasar envio de e-mail hecho con la funcion mail() a PHPMailer

Hola que tal.

Realice una pagina web donde hay una seccion de sugerencias, la cual permite a los usuarios mandarme un correo electronico con sus puntos de vista. El correo que llega a mi bandeja esta diseñado en formato HTML

Primero subi mi pagina a un servidor gratuito (000webhost) y todo funcionaba de maravilla, pero luego contrate los servicios de otro servidor para que mi pagina fuera .com y aqui mi pagina de sugerencias no funciona, ya que no llegan a mi correo los comentarios de los usuarios y creo que es por que dicho servidor tiene problemas con la funcion mail().

Entonces investigue otra forma de enviar emails a un correo y encontre la funcion PHPMailer, pero por mas que leo y leo no entiendo como implementar el PHPMailer con lo que ya tengo hecho.

Me podrian ayudar a decirme que es lo que tengo que hacer y que tengo que modificar en mi codigo para poder usar esta funcion y NO perder el formato con el que me llegan los correos o de plano tengo que partir de cero en la creacion de la pagina de sugerencias.

De antemano gracias por su ayuda

Aqui les dejo el codigo de los dos archivos que utilizo y que funcionan perfectamente con la funcion mail() pero quisiera cambiar a PHPMailer:

sugerencias.php
Código:
<!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>Documento sin título</title>
<style type="text/css">
<!--
#apDiv1 {
	position:absolute;
	width:608px;
	height:115px;
	z-index:1;
	left: 296px;
	top: 45px;
}
-->
</style>
<link href="p7ccm/p7ccm01.css" rel="stylesheet" type="text/css" media="all" />
<!--[if lte IE 7]>
<link href="/p7ie_fixes/p7ccm_ie.css" rel="stylesheet" type="text/css" media="all" />
<![endif]-->
<style type="text/css">
<!--
#apDiv2 {
	position:absolute;
	width:532px;
	height:115px;
	z-index:2;
}
-->
</style>
</head>

<body>
<div id="apDiv1">
  <div id="p7CCM_1" class="p7CCM01 p7ccm01-outer-border p7ccm01-rounded p7ccm01-outer-shadow p7ccm01-auto">
    <div class="p7ccm01-content-row p7ccm01-top-rounded p7ccm01-bottom-rounded p7ccm01-row-inner-shadow p7ccm-row">
      <div class="p7ccm01-1col-column1 p7ccm-col">
        <div class="p7ccm01-1col-column1-cnt p7ccm01-content p7ccm01-top-rounded p7ccm01-bottom-rounded">
          <div id="apDiv2">
            <form id="form_envio" name="form_envio" method="post" action="sendformulario.php" enctype="multipart/form-data">
              <table width="100%" border="1">
                <tr>
                  <td>Nombre:</td>
                  <td><label>
                    <input type="text" name="nombre" id="nombre" />
                  </label></td>
                  <td>&nbsp;</td>
                </tr>
                <tr>
                  <td>Apellido&nbsp;Paterno:</td>
                  <td><label>
                    <input type="text" name="ap_pat" id="ap_pat" />
                  </label></td>
                  <td>&nbsp;</td>
                </tr>
                <tr>
                  <td>Apellido Materno:</td>
                  <td><label>
                    <input type="text" name="ap_mat" id="ap_mat" />
                  </label></td>
                  <td>&nbsp;</td>
                </tr>
                <tr>
                  <td>Ciudad:</td>
                  <td><label>
                    <input type="text" name="ciudad" id="ciudad" />
                  </label></td>
                  <td>&nbsp;</td>
                </tr>
                <tr>
                  <td>Correo electronico:</td>
                  <td><label>
                    <input type="text" name="email" id="email" />
                  </label></td>
                  <td>&nbsp;</td>
                </tr>
                <tr>
                  <td>Sugerencias</td>
                  <td><label>
                    <textarea name="sugerencias" id="sugerencias" cols="45" rows="5"></textarea>
                  </label></td>
                  <td>&nbsp;</td>
                </tr>
                <tr>
                  <td>&nbsp;</td>
                  <td><label>
                    <input type="submit" name="enviar" id="enviar" value="Enviar Sugerencias" />
                  </label></td>
                  <td><label>
                    <input type="hidden" name="gerencia" id="gerencia" value="[email protected]"/>
                  </label></td>
                </tr>
              </table>
            </form>
          </div>
          <p>&nbsp;</p>
          <p>&nbsp;</p>
          <p>&nbsp;</p>
          <p>&nbsp;</p>
          <p>&nbsp;</p>
          <p>&nbsp;</p>
          <p>&nbsp;</p>
        </div>
      </div>
    </div>
  </div>
</div>
</body>
</html>

sendformulario.php
Código:
<?php     

// Direccion del destinatario

$destinatario = $_REQUEST["gerencia"];


$boundary = md5(time().rand(1,100));
$fecha = date("d-M-y H:i");

?>

<?php
/* VARIABLES DEL FORMULARIO:
Introducir las que haga falta: */


$content='


<html>
<head>
<title>Envio de Sugerencias</title>
<style type="text/css">
<!--
#datos {
	position:absolute;
	width:780px;
	left: 164px;
	top: 316px;
	text-align: center;
}
#apDiv1 #form1 table tr td {
	text-align: center;
	font-weight: bold;
}
#apDiv2 {
	position:absolute;
	width:49px;
	height:45px;
	z-index:2;
	left: 12px;
	top: 11px;
}
#apDiv1 #notificacion table tr td {
	text-align: center;
}
#apDiv1 #notificacion table tr td {
	text-align: left;
}
#apDiv1 #notificacion table tr td {
	text-align: center;
	font-family: Arial, Helvetica, sans-serif;
}
#apDiv3 {
	position:absolute;
	width:833px;
	height:115px;
	z-index:1;
	left: 99px;
	text-align: center;
	top: 16px;
}
-->
</style>
</head>

<body>
<div id="apDiv3">
  <table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#000000">
    <tr>
      <td><table width="100%" border="0">
        <tr>
          <td style="text-align: center"><img src="imagenes/Real de Boca_JPG.jpg" width="284" height="166"></td>
        </tr>
        <tr>
          <td><p>&nbsp;</p>
            <p style="font-family: Helvetica LT Condensed; color: #008895; font-weight: bold; font-size: 22px; text-align: center;">ENVIO DE SUGERENCIAS</p></td>
        </tr>
        <tr>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td style="font-family: Helvetica LT Condensed; font-size: 18px;"><spanHelvetica LT Condensed"; font-size: 18px;"><span style="font-weight: bold">Nombre:</span>&nbsp; '.$_POST["nombre"].'</span> '.$_POST["ap_pat"].'&nbsp; <spanHelvetica LT Condensed"; font-size: 18px;">'.$_POST["ap_mat"].'&nbsp;</span></td>
        </tr>
        <tr>
          <td style="font-family: Helvetica LT Condensed; font-size: 18px;"><span style="font-weight: bold">Ciudad:</span>&nbsp; '.$_POST["ciudad"].'</td>
        </tr>
        <tr>
          <td style="font-family: Helvetica LT Condensed; font-size: 18px;"><span style="font-weight: bold">Correo Electrónico:</span>&nbsp; '.$_POST["email"].'</td>
        </tr>
        <tr>
          <td><p>&nbsp;</p>
            <p style="font-family: Helvetica LT Condensed; font-size: 18px;"><span style="font-weight: bold">Sugerencias:</span>&nbsp; <span style="text-align: justify">'.$_POST["sugerencias"].'</span></p></td>
        </tr>
        <tr>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td><p style="text-align: left; font-size: 14px; font-family: Helvetica LT Condensed;">&nbsp;</p>
            <p style="text-align: left; font-size: 14px; font-family: Helvetica LT Condensed;"><span style="font-weight: bold">Enviado el día:</span>&nbsp;&nbsp; '.$fecha.'</p></td>
        </tr>
        <tr>
          <td style="font-family: Helvetica LT Condensed; font-size: 14px;"><span style="font-weight: bold">Enviado desde la página:</span> &nbsp; '.$destinatario.'</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
        </tr>
      </table></td>
    </tr>
  </table>
</div>
</body>
</html>


';


/* ASUNTO DEL MENSAJE:
Se utilizará una variable del array, por ejemplo, el nombre */

$asunto = "Sugerencias de Clientes";


/* ENVIAMOS EL EMAIL
Como dirección de remitente usamos la que ha enviado por el formulario,
aunque esta variable es modificable */


mail($destinatario,$asunto,$content,"MIME-Version: 1.0\nContent-type: text/html; charset=UTF-8\nFrom: hotelrealdeboca.com");
// IR O REDIRIGIR A UNA PAGINA DE CONFIRMACION
echo "<script language=Javascript> location.href=\"sugerencias_enviadas.php\"; </script>";
?>