Re: adjunto en correo
| From: | .: christian mazur :. | Date: | Wed, 27 Jul 2005 16:10:22 +0000 |
| Subject: | Re: adjunto en correo | ||
| References: | 1 | Groups: | php.general.es |
| Request: | Send a blank email to general-es+get-55465@lists.php.net to get a copy of this message | ||
Abajo te envío un ejemplo que actualmente tengo
en uso.
éxitos.
Christian Mazur
Tecnologías web.-
ITGestión - Desarrollos informáticos.
Buenos Aires / Argentina
http://www.itgestion.com.ar
function enviar_adjunto($archivo,$asunto)
{
$mail_enviar='direccion@itgestion.com.ar';
$buffer = implode("", file($archivo));
$buffer=chunk_split(base64_encode($buffer));
// Cabeceras
$cabecera = "MIME-version: 1.0\n";
$cabecera .= "Content-type: multipart/mixed; ";
$cabecera .= "boundary=\"Message-Boundary\"\n";
$cabecera .= "Content-transfer-encoding: 7BIT\n";
$cabecera .= "X-attachments: $archivo";
// Mensaje
$mensaje = "--Message-Boundary\n";
$mensaje .= "Content-type: text/plain; charset=ISO-8859-1\n";
$mensaje .= "Content-transfer-encoding: 7BIT\n";
$mensaje .= "Content-description: Mail message body\n\n";
// Adjuntar el fichero
$mensaje .= "\n\n--Message-Boundary\n";
$mensaje .= "Content-type: Binary; name=\"$archivo\"\n";
$mensaje .= "Content-Transfer-Encoding: BASE64\n";
$mensaje .= "Content-disposition: attachment; filename=\"$archivo\"\n\n";
$mensaje .= "$buffer\n";
$mensaje .= "--Message-Boundary--\n";
@mail($mail_enviar,$asunto,$mensaje,$cabecera);
}
system('gzip -9',$archivo_gz);
//echo "<a href='reportes/".$archivo."' class='link'>click
aquí para
descargar el archivo: ".$archivo."</a>";
enviar_adjunto ("reportes/".$archivo,'Backup del file');
----- Original Message -----
From: "Carlos Niño Alonso" <carlos@ineteca.com>
To: <php-es@lists.php.net>
Sent: Wednesday, July 27, 2005 3:44 AM
Subject: [PHP-ES] adjunto en correo
>
>
> Hola lista;
>
> ¿Como puedo enviar un archivo adjunto (una imagen) en un correo creado con
php?
>
> y otra cosilla, soy consciente, que hace tiempo que este tema se trato en
esta
> lista, ¿ya no hay un lugar como antaño donde consultar viejos correos?
> (precisamente para que ciclicamente no se repitan (mucho) las preguntas
como
> esta)
>
>
> gracias de antemano.
>
> --
> PHP Spanish Localization Talk Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>