Tema: Php mailer
Ver Mensaje Individual
  #4 (permalink)  
Antiguo 14/04/2009, 00:52
manugu87
 
Fecha de Ingreso: abril-2009
Mensajes: 8
Antigüedad: 15 años
Puntos: 0
Respuesta: Php mailer

Este es el código


<?php
include ('./class/class.phpmailer.php');
include ('./class/class.smtp.php');
if(isset($_POST['inter'])){
$mail = new PHPMailer(); //creamos un objeto de la clase
$mail->AddAddress("[email protected]");
$mail->IsSMTP(); //el objeto va a usar el protocolo SMTP
$mail->Host = "10.240.216.89"; // servidor SMTP
$mail->From = "[email protected]";
$mail -> FromName = "prueba";
$mail->Subject = "Prueba";
$mail->Body = "Prueba";

$archivo=$_FILES['fich']['tmp_name'];
$nombre=$_FILES['fich']['name'];



$mail->AddAttachment($archivo,$nombre);
if(!$mail->Send())
{
echo "<br>Mensaje NO enviado-->";
echo "Error: " . $mail->ErrorInfo;
//muestra el error de un envío fallido

}
else
{
echo "Enviado";
}
}
else
{
?>
<form method='post' enctype='multipart/form-data' name='formu' action='index.php'>
<br><br><table>
<tr>
<td>
<input type="hidden" name='inter'>
<input type="file" name='fich' id='fich'>
<input type="submit" >

</td>
</tr>
</table>
</form>
<?php
}

?>