Foros del Web » Programando para Internet » PHP »

enviar mail con php y html por pear

Estas en el tema de enviar mail con php y html por pear en el foro de PHP en Foros del Web. buenas tardes esta es una gran interrogante... ya logro enviar correos mediante mi aplicacion, hay que resalta que la aplicacion esta en debian por lo ...
  #1 (permalink)  
Antiguo 22/11/2011, 13:04
 
Fecha de Ingreso: febrero-2011
Mensajes: 64
Antigüedad: 13 años, 1 mes
Puntos: 0
De acuerdo enviar mail con php y html por pear

buenas tardes esta es una gran interrogante... ya logro enviar correos mediante mi aplicacion, hay que resalta que la aplicacion esta en debian por lo tanto se debe montar algo llamado PEAR. pero esto es lo de menos porq ya lo hice y todo correo bien, ahora la pregunta es, como hago para que dentro del html me salgan valores de .$_SESSION["Cod"]. tengo entendido que dentro del mensaje HTML es asi ".$_SESSION["Cod"]." pero nada que ver no me sale, disgo que con el session por probar porq logicamente se mostrarian mas datos de una consutal y les haga un array aqui esta mi codigo, la prueba la estoy haciendo con ".$_SESSION["codigo1"]." -> en la novena linea despues del body del html

Código PHP:
<?php session_start();
?>
<?php
  
include('Mail.php');
include(
'Mail/mime.php');
include(
'Mail/mail.php');     // adds the enhanced send function

include("conex.php");
$link=Conectarse();
 
$text 'Text version of email';
$html '<html><style type="text/css">
<!--
.Estilo1 {color: #CC0000}
.Estilo12 {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
}
.Estilo17 {font-family: Arial, Helvetica, sans-serif; font-size: 14px; color: #FFFFFF; }
.Estilo18 {
    font-size: 24px;
    font-family: Geneva, Arial, Helvetica, sans-serif;
}
.Estilo19 {color: #000000}
-->
</style>
<body><div align="center">
  <table width="902" border="0">
    <tr>
      <td width="125"><img src="CBP/sagtax/logo_pc.png" width="100" height="34" /></td>
      <td width="610"><div align="center" class="Estilo18">Solicitud de Servicio de Taxi y Encomienda</div></td>
      <td width="145">N° Solicitud 
        <label><br />
      " .$_SESSION["codigo1"]. "</label></td>
    </tr>
  </table>
</div>
<br /><table border="0" align="center">
  <tr>
    <td width="6" height="276" rowspan="2" valign="middle">&nbsp;</td>
    <td width="885" height="728" valign="top"><p class="Estilo1">Fecha de Solicitud : <span class="Estilo12">&nbsp;&nbsp;</span> 
        <script>
var meses = new Array ("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre");
var diasSemana = new Array("Domingo","Lunes","Martes","Miércoles","Jueves","Viernes","Sábado");
var f=new Date();
document.write(diasSemana[f.getDay()] + ", " + f.getDate() + " de " + meses[f.getMonth()] + " de " + f.getFullYear());
          </script>
    </p>
    
      <table width="884" border="0">
        <tr bgcolor="#CCCCCC">
          <td width="345">Nombre y Apellido</td>
          <td colspan="2">N° Cedula de Indentidad</td>
          <td width="212">Telefono</td>
        </tr>
        <tr>
          <td>1. 
            <?php echo $filfech[3]; ?><label></label></td>
          <td colspan="2"> <label><?php echo $filfech[2]; ?></label></td>
          <td><?php echo $filfech[4]; ?>&nbsp;</td>
        </tr>
        <tr>
          <td>2. 
            <label><?php echo $filfech1[1]; ?></label></td>
          <td colspan="2"><label><?php echo $filfech1[2]; ?></label></td>
          <td><?php echo $filfech1[7]; ?></td>
        </tr>
        <tr>
          <td>3. 
            <label><?php echo $filfech1[4]; ?></label></td>
          <td colspan="2"><label><?php echo $filfech1[5]; ?></label></td>
          <td><?php echo $filfech1[8]; ?></td>
        </tr>
        <tr bgcolor="#CCCCCC">
          <td colspan="4">Gerencia/Departamento</td>
        </tr>
        <tr>
          <td><?php echo $filfech[10]; ?>&nbsp;</td>
          <td width="153">&nbsp;</td>
          <td colspan="2">&nbsp;</td>
        </tr>
      </table>
      <p><span class="Estilo1">&nbsp;&nbsp;&nbsp;Motivo de la Solicitud</span><span class="Estilo12"><br />
&nbsp;&nbsp; <img src="separador_modulo.png" width="550" height="1" /></span></p>
      <table width="876" border="0">
        <tr>
          <td><?php echo $filfech[14]; ?>&nbsp;</td>
        </tr>
      </table>
      <p><span class="Estilo1"> &nbsp;&nbsp;&nbsp;Descripcion del Servicio</span><span class="Estilo12"><br />
&nbsp;&nbsp; <img src="separador_modulo.png" width="550" height="1" /></span></p>
      <table width="882" border="0">

        <tr class="Estilo1">
          <td width="339" class="Estilo1 Estilo19"><span class="Estilo1">Fecha del Servicio:</span> 
          <label><?php echo $filfech[5]; ?></label></td>
          <td width="282"> <span class="Estilo1">Hora del Servicio:</span><span class="Estilo19"> 
            <label>
            <?php echo $filfech[8]; ?>                </label>
          </span></td>
          <td width="247"> <span class="Estilo1">Con Espera:</span><span class="Estilo19"> 
            <label><?php echo $filfech[9]; ?></label>
          </span></td>
        </tr>
      </table>
      <br />
      <table width="881" border="0">
        <tr valign="top" bgcolor="#FFFFFF">
          <td height="38" colspan="4"><span class="Estilo1">Origen:</span> <span class="Estilo19">
          <label><?php echo $filfech[7]; ?></label>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="Estilo1">Destino:</span> <span class="Estilo19">
<label><?php echo $filfech[8]; ?></label>
</span></td>
        </tr>
        <tr bgcolor="#CCCCCC">
          <td width="234"><span class="Estilo19">Direcion de Origen</span></td>
          <td width="264"><span class="Estilo19">Direccion de Destino</span></td>
          <td width="170"><span class="Estilo19">Persona de Contacto</span></td>
          <td width="195"><span class="Estilo19">Telefono</span></td>
        </tr>
        <tr>
          <td><label>
            <textarea name="textfield19" cols="35" id="textfield19"><?php echo $filfech[18]; ?></textarea>
          </label></td>
          <td><textarea name="textfield21" cols="35" id="textfield21"><?php echo $filfech[19]; ?></textarea></td>
          <td><?php echo $filfech[3]; ?></td>
          <td><?php echo $filfech[4]; ?></td>
        </tr>
      </table>
      <br />
      <table width="243" border="0">
        <tr>
          <td width="237" bgcolor="#CCCCCC">Centro de Costo</td>
        </tr>
        <tr>
          <td>1.<?php echo $filfech[11]; ?></td>
        </tr>
        <tr>
          <td>2.<?php echo $filfech1[3]; ?></td>
        </tr>
        <tr>
          <td>3.<?php echo $filfech1[6]; ?></td>
        </tr>
      </table>
      <p><span class="Estilo1">&nbsp;&nbsp;&nbsp;Aprobacion</span><span class="Estilo12"><br />
&nbsp;&nbsp; <img src="separador_modulo.png" width="550" height="1" /></span></p>
      <table width="594" border="0">
        <tr bgcolor="#CCCCCC">
          <td width="288">Nombre y Apellido</td>
          <td width="296">Email</td>
        </tr>
        <tr>
          <td><?php echo $filfech[12]; ?>&nbsp;</td>
          <td><?php echo $filfech[20]; ?>&nbsp;</td>
        </tr>
      </table>
      <p><span class="Estilo1">&nbsp;&nbsp;&nbsp;Cooperativa</span><span class="Estilo12"><br />
&nbsp;&nbsp; <img src="separador_modulo.png" width="550" height="1" /></span></p>
      <table width="586" border="0">
        <tr bgcolor="#CCCCCC">
          <td width="288">Nombre</td>
          <td width="288">Tipo de Vehiculo</td>
        </tr>
        <tr>
          <td><?php echo $_SESSION["cooperativa"] ?></td>
          <td><?php echo $_SESSION["vehiculo"] ?></td>
        </tr>
      </table>
      <p></p>
      <p>&nbsp;</p>
      <p align="center">_______________________________________<br />
Firma quien Autoriza<br />
<br />
<br />
  <input type="button" name="button" id="button" value="imprimir" onclick="javascript:window.print()" />
  <br />
      </p>
    </td>
    <td width="10" rowspan="2" valign="middle">&nbsp;</td>
  </tr>
  <tr>
    <td height="21" valign="bottom"><span class="Estilo1">_______________________________________________________________________________________________________________</span></td>
  </tr>
</table>
<p align="center" class="Estilo1">&nbsp;</p>
<p align="center" class="Estilo1">
  <label></label>
</p></body></html>'
;
$file '/home/richard/example.php';
$crlf "\n";
$hdrs = array(
              
'From'    => '[email protected]',
              
'Subject' => 'Solicitud de Taxi'
              
);

$mime = new Mail_mime($crlf);

$mime->setTXTBody($text);
$mime->setHTMLBody($html);
$mime->addAttachment($file'text/plain');

//do not ever try to call these lines in reverse order
$body $mime->get();
$hdrs $mime->headers($hdrs); 
 
 
$host '10.60.161.13';
 
$username '';
 
$password '';
 
 
$headers = array ('From' => $from,
   
'To' => $to,
   
'Cc' => $cc,
   
'Subject' => $subject);


 
$smtp Mail::factory('smtp',
   array (
'host' => $host,
     
'auth' => false,
     
'username' => $username,
     
'password' => $password));
 
$mail $smtp->send('[email protected]'$hdrs$body);
 
 if (
PEAR::isError($mail)) {
   echo(
"<p>" $mail->getMessage() . "</p>");
  } else {
   echo(
"<p>Message successfully sent!</p>");
  }
 
?>

Etiquetas: html
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 17:43.