Avatar Image
Usuario habitual
Usuario habitual

Vale, tengo el código que está compuesto de 2 archivos, los he configurado pero no me van. Son los siguientes:

Este es el codigo del formulario: f_attach.php

<title>COLABORACIÓN</title>

<form enctype="multipart/form-data" name=doit action="env_attach.php" method=POST>
<table cellpadding=0 cellspacing=0 width="295"><tr>
<td width="295" height="26"> <font face="Arial, Helvetica, sans-serif" size="2"><b>Tu
nombre:<br>
</b></font>
<input type="text" name="name" size=30><br>
&nbsp;</td>
</tr>
<tr>
<td width="295"> <font face="Arial, Helvetica, sans-serif" size="2"><b>Tu
e-mail:<br>
</b></font>
<input type="text" name="from" size=30><br>
&nbsp;</td>
</tr>
<tr>
<td width="295"> <font face="Arial, Helvetica, sans-serif" size="2"><b>Archivo:<br>
</b></font>
<input type=file name="attach" size=30><br>
&nbsp;</td>
</tr>
<td width="295">
<tr>
<td width="295" height="23"><font face="Arial, Helvetica, sans-serif" size="2"><b>Asunto:<br>
</b></font>
<input type="text" name="subject" size=30> <br>
&nbsp;</td>
</tr></table>
<p align="left">
<font face="Arial, Helvetica, sans-serif" size="2"><b>Mensaje:</b></font><br>
<textarea name="body" rows=10 cols=35 wrap="message"></textarea><br><br>
<input type="submit" name="sendmail" value="enviar"> </p>
</form>


Este es el del envio: env_attach.php

<?
$mailheaders = "Return-Path: $fromn";
$mailheaders .= "From: $fromn";
$mailheaders .= "name: $namen";
//$mailheaders = "From: $fromn";
$mailheaders .= "X-Mailer: Expresateweb Email Interfacen";
$msg_body = stripslashes($body);
if ($attach != "none&quotGiño
{
$file = fopen($attach, "r&quotGiño;
$contents = fread($file, $attach_size);
$encoded_attach = chunk_split(base64_encode($contents));
fclose($file);
$mailheaders .= "MIME-version: 1.0n";
$mailheaders .= "Content-type: multipart/mixed; ";
$mailheaders .= "boundary=\"Message-Boundary\"n";
$mailheaders .= "Content-transfer-encoding: 7BITn";
$mailheaders .= "X-attachments: $attach_name";
$body_top = "--Message-Boundaryn";
$body_top .= "Content-type: text/plain; charset=US-ASCIIn";
$body_top .= "Content-transfer-encoding: 7BITn";
$body_top .= "Content-description: Mail message bodynn";
$msg_body = $body_top . $msg_body;
$msg_body .= "nn--Message-Boundaryn";
$msg_body .= "Content-type: $attach_type; name=\"$attach_name\"n";
$msg_body .= "Content-Transfer-Encoding: BASE64n";
$msg_body .= "Content-disposition: attachment; filename=\"$attach_name\"nn";
$msg_body .= "$encoded_attachn";
$msg_body .= "--Message-Boundary--n";
}
$extra="-f".$from;
mail("nombre@nombre.com", stripslashes($subject), $msg_body, $mailheaders, $extra);
echo "<h3>GRACIAS POR TU COLABORACIÓN</h3>";
?>

Gracias con antelación, esque llevo bastante tiempo intentando hacerlo, pero no puedo Enfurruñado salu2

Avatar Image
@man / @woman
@man / @woman

Hay todo un subforo dedicado a php.


Manteniendonos en las temáticas de los foros, mejor para todos.

"Netiqueta" en los foros, como comportarse y preguntar en los foros.

No Setup Programs
ATENCIÓN: Este tema no tiene actividad desde hace más de 6 MESES,
te recomendamos abrir un nuevo tema en lugar de responder al actual
Opciones:
Ir al subforo:
Permisos:
TU NO PUEDES Escribir nuevos temas
TU NO PUEDES Responder a los temas
TU NO PUEDES Editar tus propios mensajes
TU NO PUEDES Borrar tus propios mensajes
Temas similares
TemaUsuariosRespuestasVisitasActividad
Por: , el 22/Oct/2005, 10:44
josejjs MaIcOl27kOct/05
Por: , el 27/Ene/2012, 01:23
djom20 GestionXls NoSetup.org62kJan/12
Por: , el 04/Ago/2010, 17:48
frankaso Josepepe03312kAug/10
Por: , el 11/Mar/2010, 17:13
Rnstzjc Torry_II1531Mar/10
Por: , el 14/Sep/2009, 21:26
Josac NoSetup.org1711Sep/09