![Adios](http://static.forosdelweb.com/fdwtheme/images/smilies/adios.gif)
Código:
<form action="mail.php" method="post" enctype="multipart/form-data"> <table width="500" border="0" align="center" cellpadding="4" cellspacing="4" bgcolor="#CC6666"> <tr bgcolor="#993333"> <td>Destinatario</td> <td><input type="text" name="destino" value="<?php echo $a;?>"></td> </tr> <tr bgcolor="#993333"> <td>Asunto</td> <td><br> <input type="text" name="asunto"></td> </tr> <tr bgcolor="#993333"> <td>Flyer</td> <td><input type="file" name="archivo"></td> </tr> <tr bgcolor="#993333"> <td>Mensaje</td> <td><textarea name="mensaje"></textarea></td> </tr> <tr bgcolor="#993333"> <td><span class="Estilo6"></span></td> <td><input type="submit" name="btsend" value="Enviar Email"> <input type="hidden" name="action" value="send" /></td> </tr> <tr bgcolor="#993333"> <td colspan="2"><span class="Estilo6"></span><span class="Estilo6"></span><span class="Estilo6"></span></td> </tr> </table> </form>
Código PHP:
<?php
require("class.phpmailer.php");
if ($_POST['action'] == "send") {
$varname = $_FILES['archivo']['name'];
$vartemp = $_FILES['archivo']['tmp_name'];
$mail = new PHPMailer();
$mail->Host = "localhost";
$mail->From = "[email protected]";
$mail->FromName = "ZI";
$mail->Subject = $_POST['asunto'];
$mail->AddAddress($_POST['destino']);
if ($varname != "") {
$mail->AddAttachment($vartemp, $varname);
}
$body = "<strong>Mensaje</strong><br><br>";
$body.= $_POST['mensaje']."<br>";
$body.= "<i>Enviado por http://www..com.ar</i>";
$mail->Body = $body;
$mail->IsHTML(true);
$mail->Send();
}
echo "su mensaje ha sido enviado satisfactoriamente";
?>