Ver Mensaje Individual
  #1 (permalink)  
Antiguo 29/01/2007, 12:58
chispazo
 
Fecha de Ingreso: diciembre-2006
Mensajes: 26
Antigüedad: 17 años, 4 meses
Puntos: 0
Incrustar una imagen en con la funcion() mail

Hola quiero incrustar una imagen en el envio de una mail... al hacerlo me funciona bien, pero no se me incrusta la imagen. Lo hago con un formulario en el cual incluyo el codigo q' envia el mail a todos los mail de la lista de mail de la base de datos.. el codigo es el siguiente:

enviaMaillist.php:
<?php
include("class.phpmailer.php");
$mail = new phpmailer();
$enviar=isset($_POST['enviar']) ? true : false;
?>
<?php
/*******Conectamos y seleccionamos la base de datos ********/
$db_host=" "; //Host del mysql
$db_user=" "; //Usuario del mysql
$db_pass=" "; //Password del mysql
$db_database=" "; //db donde se creará la tabla users
$db_table=" ";

$con = mysql_connect($db_host, $db_user, $db_pass);
mysql_select_db($db_database, $con);


$asunto = ($_POST['asunto']); //campo titulo en el form html
$From = "[email protected]"; //remitente
$boundary = "==MP_Bound_xyccr948x==";
$headers = "From:".$De."\nReply-To:".$email."\n";
$headers = "X-Mailer:PHP/".phpversion()."\n";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/plain/img/html; charset=ISO-8859-1;";
$headers .= "Content-Transfer-Encoding: 8bit\r\n" .
$headers .= "boundary = $boundary\"\r\n";
$headers .= "From: [email protected]\r\n";
$mensaje = ($_POST['mensaje']); //campo mensaje en el form html
$mail->AddAttachment("/var/tmp/file.tar.gz"); // attachment
$mail->AddAttachment("/tmp/image.jpg", "new.jpg");
$mail->IsHTML(true);



if (isset ($HTTP_POST_FILES["archivo"])) {
$tmp_name = $HTTP_POST_FILES["archivo"]["tmp_name"];
$name = $HTTP_POST_FILES["archivo"]["name"];
$archivo = $HTTP_POST_FILES["archivo"]["type"];
$mail -> AddAttachment ($tmp_name, $name, $archivo);
}


if (!empty($enviar)) {

$Query="SELECT email FROM mail_list ";
$resultado = mysql_query("SELECT email FROM mail_list");
while ($row=mysql_fetch_array($resultado)){
if (!empty($row['email'])){
mail($row['email'],$asunto,$mensaje,$archivo_name,"From: $From <$headers>");
}
}
}
?>

Ese es el codigo con q' envio el mail, el cual funciona pqeo solo me llaga el nombre de la imagen, no la imagen fisica...
Haber si me podrian ayudar, porfavor...