RE: [PHP-ES] Mandar un Mail
| From: | Marco Eyzaguirre Alemán | Date: | Wed, 24 Oct 2001 16:06:47 +0000 |
| Subject: | RE: [PHP-ES] Mandar un Mail | ||
| References: | 1 | Groups: | php.general.es |
| Request: | Send a blank email to general-es+get-15121@lists.php.net to get a copy of this message | ||
claro, para esto es necesario construir por PHP el fuente del mail (formato
html), te mando un codigo bastante simple donde puedes adjuntar un archivo,
en este caso el archivo a adjuntar es el *.swf, no es necesario que te rayes
con entender el codigo, solo basta llenar los parámetros iniciales:
Saludos
Marco
-----Mensaje original-----
De: Gaffuri Emiliano [mailto:eg@cobusgroup.com.ar]
Enviado el: Miércoles, 24 de Octubre de 2001 09:14 AM
Para: lista@phpes.com
Asunto: [PHP-ES] Mandar un Mail
Holas a todos, necesito mandar un mail institucional de la empresa en donde
trabajo,
este mail tiene un par de animaciones hechas en flash.
Ahora a lo que voy yo, existe alguna forma de mandar dicho mail por la
funcion mail() de Php.??.
O lo tengo que mandar de otra forma... la idea es que es para varias
direcciones de mail, por lo menos 1000.
Y estoy buscando la forma de que se haga lo mas automatizado posible.
Gracias.
//**************************************************************************
****************************************
<?
// ************************************
// E-mail functions (binary attachment)
// ************************************
$message_to_send = "
<html>
<head>
<STYLE TYPE=\"text/css\">
input.tipo2 {FONT-FAMILY: verdana, arial, sans-serif; FONT-SIZE: 10px;
color:dddddd; background-color:2f4b7b}
select.tipo2 {FONT-FAMILY: verdana, arial, sans-serif; FONT-SIZE: 10px;
color:0f2b5b; background-color:e3e3e3}
textarea.tipo2 {FONT-FAMILY: verdana, arial, sans-serif; FONT-SIZE: 10px;
color:0f2b5b; background-color:e3e3e3}
<!--
A:link {color:\"#2f4b7b\";}
A:visited {color:#2f4b7b;}
A:hover {color:\"6f8bbb\";}
-->
</STYLE>
</head>
<body bgcolor=f3f3f3 topmargin=10><center> ..... etc,etc ....";
$dest_email="meyzagui@ilender.com.pe";
$title="Atachando fotos";
$from="webcorp@ilender.com.pe";
$type="jpg";
$filename="foto.jpg";
$path="/var/www/html/webcorp/ventas/auto/foto.jpg";
$type="jpg";
m_attach_bin($dest_email, $title, $message_to_send, $from, $type);
m_attach_file_bin($filename, $path, $type);
m_attach_send_bin($type);
function m_attach_bin( $to_fname, $subject_ftext, $message, $from, $type )
{
static $hold_to="";
static $hold_subject="";
static $hold_from="";
static $hold_message="";
static $boundary="-----------------kjbsdf9873987348735";
$MIME="MIME-Version:1.0\nContent-Type:multipart/mixed;\n\tboundary=\"$bounda
ry\"\n\nThis is a multi-part messagein MIME format.\n\n";
$startMsg="\n--$boundary\nContent-Type:text/html;\n\tcharset=\"iso-8859-1\"\
nContent-Transfer-Encoding: 8bit\n\n";
$ending="\n--$boundary--";
if ( $to_fname=="" ) /* send it! */
{
$hold_message=$hold_message . $ending;
return( mail( $hold_to, $hold_subject, $hold_message, $hold_from ) );
}
elseif ( $message=="" ) /* we must be attaching a file */
{
$hold_message=$hold_message .
"\n--$boundary\nContent-Type:image/".$type.";\n\tname=\"$to_fname\"\nContent
-Transfer-Encoding:base64\nContent-Disposition:inline;\n\tfilename=\"$to_fna
me\"\n\n$subject_ftext";
}
else /* starting a new message */
{
$hold_to=$to_fname;
$hold_subject=$subject_ftext;
$hold_message=$startMsg . $message."\n\n";
$hold_from="From: $from\n$MIME\n";
}
};
function m_attach_file_bin( $shortname, $longname, $type )
{
$fp=fopen($longname,"r");
$in = fread( $fp, filesize( $longname ) );
fclose( $fp );
$out= chunk_split(base64_encode($in));
return( m_attach_bin( $shortname, $out, "", "", $type ) );
};
function m_attach_send_bin($type)
{
return( m_attach_bin( "","","","", $type ) );
};
//**************************************************************************
***********************************