Ver Mensaje Individual
  #1 (permalink)  
Antiguo 10/01/2007, 17:22
chispazo
 
Fecha de Ingreso: diciembre-2006
Mensajes: 26
Antigüedad: 17 años, 4 meses
Puntos: 0
Pregunta Mandar Imagenes Por Mail Masivo...

Hola, estoy mandando un mail masivo a todos los mail q' llamo desde una base de datos, el cual me funiona, pero quiero enviarlo con alguna imagen...
Para eso tengo dos archivos, uno es el formulario y el otro el codigo php q' envia el mail masivo...

formulario:
<?
session_start();
$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="mail_list";

$con = mysql_connect($db_host, $db_user, $db_pass);
mysql_select_db($db_database, $con);
include("enviaMaillist.php");
if ($enviar=="enviar"){

mail($row['email'],$asunto,$mensaje,$archivo,"From: <$De>");
}
?>
<?
if ($borrar=="Borrar"){
$asunto="";
$mensaje="";
}
if ($boton=="Eliminar"){
$sql="DELETE FROM MAIL_LIST WHERE EMAIL='$email'";
mysql_query($sql,$con);
$email="";
}
// si presiono el boton enviar......
if ($enviar=="Enviar"){
$logroCopiar=0;
// cargo el archivio
if (isset($_POST['enviar']))
if(is_uploaded_file($_FILES['archivo']['tmp_name'])) // verifica haya sido cargado el archivo
if(move_uploaded_file($_FILES['archivo']['tmp_name'], $_FILES['archivo'], "img/".$archivo_name))
// se coloca en su lugar final
echo "error al copiar el archivo";
else
{
echo "archivo subido con exito";
$logroCopiar=1;

}
}
?>
<html>
<head>
<title>..::Sitio Oficial de FreakMM::..</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />



</head>

<body>
<FORM name="mail_masivo" method="POST" action="" enctype="multipart/form-data">
<table>
<tr>
<td>Asunto</td>
<td> <input name="asunto" type="text" id="asunto" value="<? echo $asunto?>" ></dt>
</tr>
<tr>
<td>Mensaje</td>
<td> <textarea name="mensaje" id="mensaje" cols="42" rows="8" value="<? echo $mensaje?>" >Deje su mensaje...</textarea></td>
</tr>
<tr>
<td>Foto</td>
<tr>
<td> <input name="archivo" type="file" id="archivo"></td>
</tr>
<tr>
<td><input name="enviar" type="submit" class="out1" id="enviar" value="enviar"></td>
</tr><tr>
<td><input name="borrar" type="reset" class="out1" id="Borrar" value="Borrar"></td>
</table>
</form>
<table>(muestra todos los mail de la base de datos)
<tr>
<td width="272" height="30"><strong>Email</strong></td>
<td width="50"><strong>Borrar</strong></td>
</tr>
<?
$Query="SELECT email FROM mail_list order by email";
// ahora ejecutamos el sql;
$resultado=mysql_query($Query,$con);

while ($row=@mysql_fetch_array($resultado)){
?>
<tr>
<td><? echo $row["email"];?></td>
<td><div align="center"><a href="editMaillist.php?boton==Eliminar&email=<? echo $row["EMAIL"];?>"><img src="img/button_drop.png" width="11" height="13"></div></td>
</tr>
<? }?>
</table>
</body>
</html>

Luego el archivo q' incluyo y envia la infirmacion es:
enviaMaillist.php

<?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="mail_list";

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


$asunto = ($_POST['asunto']); //campo titulo en el form html
$De = "[email protected]"; //remitente
$headers = 'X-Mailer: PHP/' . phpversion() . "\r\n";
$headers = "MIME-Version: 1.0\r\n";
$headers = "Content-type: text/html; charset=iso-8859-1\n";
$headers = "Content-Transfer-Encoding: 8bit\r\n\r\n";
$mensaje = ($_POST['mensaje']); //campo mensaje en el form html
$archivo_name = ($_FILES['archivo']); //campo mensaje en el form html


if ($enviar=="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,"From: $De <$headers>");
//if($finalizado) $cuenta_emails++;
}
}
}
?>

Que tengo mal.. haber si me podrian ayudar pa poder enviar la imagen sin problemas...