Código PHP:
<? require("phpmailer/class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true;
//$mail->SMTPSecure = "ssl";
$mail->Host = "xxxxxxx";
$mail->Port = 25;
$mail->Username = 'xxxx@xxxxx';
$mail->Password = "xxxx";
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
//====== DE QUIEN ES ========
$mail->From = $mailRemitente;
$mail->FromName = $nombreRemitente;
//$mail->AddAttachment("img/button.png", "last.gif"); //Archivo adjunto
//====== PARA QUIEN =========
$mail->Subject = $asunto;
$mail->AddAddress($mailDestinatario,"Cliente");
//$mail->AddAddress("[email protected]","Para ti alberto");
if (isset($_POST['checkid']))
{
$cliente= $_POST['checkid'];
$n = count($cliente);
$i = 0;
while ($i < $n)
{
// CODIGO DATOS ADJUNTOS//
$mail-> IsHTML (false);
$mail-> AddAttachment ("'".$cliente[$i]."'", '1000002.TIF'); // adjuntar files/invoice-user-1234.pdf, Y cambiarle el nombre a invoice.pdf
$mail-> Body = "Por favor, encontrar su factura adjunta.";
}
$mail->send();
?>
<script type="text/javascript">
alert ("El Mensaje se ha enviado con exito!");
location.href="envioMail.php";
</script>
<?
}
else
{
?>
<script type="text/javascript">
alert ("El nombre de usuario y la contraseña no coinciden");
location.href="envioMail.php";
</script>
<?
}
?>
?>