Código PHP:
<?php
require("class.phpmailer.php");
require("class.smtp.php");
$msg = "";
if ($_POST['action'] == "send") {
$varname = $_FILES['archivo']['name'];
$vartemp = $_FILES['archivo']['tmp_name'];
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->SMTPSecure = "ssl";
$mail->Host = "smtp.mail.yahoo.com";
$mail->Port = 587;
$mail->Username = "correoyahoo.es";
$mail->Password = "password";
$mail->From = "correoyahoo.es";
$mail->FromName = "alguno";
$mail->Subject = LICENCIAs;
$mail->AddAddress($_POST['destino']);
if ($varname != "") {
$mail->AddAttachment($vartemp, $varname);
}
$body = "<strong>Mensaje</strong><br><br>hola<br>";
$mail->Body = $body;
$mail->IsHTML(true);
$mail->Send();
$msg = "Mensaje enviado correctamente";
}
?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>PHP Email Attach</title>
<link href="mailattach.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" class="descdet">
<div class="borde">
<strong class="subder">Envíar Email con Adjuntos</strong><br>
Ingresar los datos en el formulario. <br>
<?php if ($msg != "") { ?><span class="conf"><?php echo $msg; ?></span><br><?php } ?>
<form action="mailattach.php" method="post" enctype="multipart/form-data">
<p> Destinatario<br>
<input type="text" name="destino" size="50">
Asunto<br>
<input type="text" name="asunto" size="50">
Adjunto<br>
<input type="file" name="archivo" size="32">
Mensaje<br>
<textarea name="mensaje" cols="47" rows="8" wrap="virtual" id="mensaje"></textarea>
<input type="submit" name="btsend" class="boton" value="Enviar Email">
<input type="hidden" name="action" value="send" />
</p>
</form>
</div>
</td>
</tr>
</table>
</body>
</html>
![sonriente](http://static.forosdelweb.com/fdwtheme/images/smilies/smile.png)
![Afirmando](http://static.forosdelweb.com/fdwtheme/images/smilies/afirmar.gif)