Ver Mensaje Individual
  #6 (permalink)  
Antiguo 06/01/2005, 17:45
Yuriria
 
Fecha de Ingreso: enero-2005
Mensajes: 4
Antigüedad: 19 años, 3 meses
Puntos: 0
Aahhaaaaaaaaaa, ahora te entiendo mejor, voy a ponerne a darle una repasada al "sendmail". Gracias por explicarme. sorry son muy novata. Este es el codigo que utilizo para enviar el mail con el archivo adjunto.


<?
header("Location: http://www.itsur.edu.mx/inicio.php" );

//Checa si el e-mail es correcto.
function emailOK($str) {
//Check empty
if(empty($str)) return false;

//Check for @
if(!ereg("@",$str)) return false;

//Check for at least 1 dot
if(!ereg("\.",$str)) return false;

//Get a user and a host
list($user, $host) = explode("@", $str);

//Make sure we have a user and host
if((empty($user)) || (empty($host))) return false;

//These characters are not allowed in email addresses
$badChars = "[ ]+| |\+|=|[|]|{|}|`|\(|\)|,|;|:|!|<|>|%|\*|/|'|\"|~|\?|#|\\$|\\&|\\^|www[.]";
return !eregi($badChars, $str);
}//End Function

$destinatario = $_POST["email"];

if (emailOk($destinatario)) {

$UN_SALTO="\r\n";
$DOS_SALTOS="\r\n\r\n";


$titulo="Información acerca del ITSUR";
//$mensaje="<html><head></head><body bgcolor= \"#4FB05E\">";
//$mensaje.= '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="400" height="325"> <param name="movie" value="promo_ITSUR.swf"> <param name="quality" value="high"> <embed src="promo_ITSUR.swf" quality="high" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type="application/x-shockwave-flash" width="400" height="325"></embed>';
//$mensaje.= $mensaje."</object></body></html>";
$responder = $_POST["email"];
$remite = $_POST["email"];
$remitente="ITSUR";

$separador = "_separador_de_trozos_".md5 (uniqid (rand()));

$cabecera = "Date: ".date("l j F Y, G:i").$UN_SALTO;
$cabecera .= "MIME-Version: 1.0".$UN_SALTO;
$cabecera .= "From: ".$remitente."<[email protected]>".$UN_SALTO ;
//$cabecera .= "Return-path: [email protected]".$UN_SALTO;
//$cabecera .= "Reply-To: [email protected]".$UN_SALTO;
$cabecera .="X-Mailer: PHP/". phpversion().$UN_SALTO;
$cabecera .= "Content-Type: text/html;".$UN_SALTO;
$cabecera .= " boundary=$separador".$DOS_SALTOS;


// Parte primera -Fichero adjunto nº 1

# Separador inicial
$adj1 ="--$separador".$UN_SALTO;

# Encabezado parcial

$adj1 .="Content-Type: application/octet-stream; name=\"promo_ITSUR.swf\"".$UN_SALTO;
$adj1 .="Content-Disposition: inline; filename=\"promo_ITSUR.swf\"".$UN_SALTO;
$adj1 .="Content-Transfer-Encoding: base64".$DOS_SALTOS;
//$adj1 .=$mensaje;

//# lectura del fichero adjuntos

$fp = fopen("promo_ITSUR.swf", "r");
$buff = fread($fp, filesize("promo_ITSUR.swf"));
fclose($fp);
//# codificación del fichero adjunto

$adj1 .=chunk_split(base64_encode($buff));

//separador final del mensaje

$adj1 .=$UN_SALTO."--$separador".$UN_SALTO;

// Unión de las diferentes partes para crear el cuerpo del mensaje


$mensaje=$adj1;

// envio del mensaje


if (mail($destinatario,$titulo,$mensaje,$cabecera)) {
echo "Gracias por rellenar el formulario. Se ha enviado correctamente.";
}

}else{
echo "¡e-mail no valido!";
}

?>