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"> </td>
<td width="885" height="728" valign="top"><p class="Estilo1">Fecha de Solicitud : <span class="Estilo12"> </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]; ?> </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]; ?> </td>
<td width="153"> </td>
<td colspan="2"> </td>
</tr>
</table>
<p><span class="Estilo1"> Motivo de la Solicitud</span><span class="Estilo12"><br />
<img src="separador_modulo.png" width="550" height="1" /></span></p>
<table width="876" border="0">
<tr>
<td><?php echo $filfech[14]; ?> </td>
</tr>
</table>
<p><span class="Estilo1"> Descripcion del Servicio</span><span class="Estilo12"><br />
<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>
</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"> Aprobacion</span><span class="Estilo12"><br />
<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]; ?> </td>
<td><?php echo $filfech[20]; ?> </td>
</tr>
</table>
<p><span class="Estilo1"> Cooperativa</span><span class="Estilo12"><br />
<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> </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"> </td>
</tr>
<tr>
<td height="21" valign="bottom"><span class="Estilo1">_______________________________________________________________________________________________________________</span></td>
</tr>
</table>
<p align="center" class="Estilo1"> </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>");
}
?>