Foros del Web » Programando para Internet » PHP »

formulario de asp a php

Estas en el tema de formulario de asp a php en el foro de PHP en Foros del Web. hola compañeros, me han pasado este formulario en asp, necesitaria muy urgente conseguir las mismas funciones en php, alguien me podria pasar el código, gracias: ...
  #1 (permalink)  
Antiguo 29/02/2004, 14:16
 
Fecha de Ingreso: febrero-2002
Ubicación: Valencia - España
Mensajes: 488
Antigüedad: 22 años, 2 meses
Puntos: 0
Exclamación formulario de asp a php

hola compañeros, me han pasado este formulario en asp, necesitaria muy urgente conseguir las mismas funciones en php, alguien me podria pasar el código, gracias:

Código PHP:
<%
    
'Envio de Mails 
    '
Autor Xema Perez

Set objArchivo 
Server.createobject("Scripting.FilesystemObject")

              
         
Set Mail Server.CreateObject("Persits.MailSender")
         
         
Mensaje Request.form("Nombre del Responsable") & vbcrlf Request.form("Direccion") & vbcrlf "Telf. " Request.form("Telefonos") & " " "E-Mail : " Request.form("E-Mail") & vbcrlf 
         Mensaje 
Mensaje vbcrlf "Nombre del Club " Request.Form("Nombre del Club") & "Nº de Equipos : " vbcrlf  vbcrlf "Categoria Benjamin " Request.form("Categoria Benjamin") & vbcrlf "Categoria Alevin " Request.form("Categoria Alevin")& vbcrlf "Categoria Infantil " Request.form("Categoria Infantil") & vbcrlf "Categoria Senior " Request.form("Categoria Senior") & vbcrlf "Categoria Cadete" Request.form("Categoria Cadete") & vbcrlf "Categoria Femenina" Request.form("Categoria Femenina") & vbcrlf "Categoria Juvenil" Request.form("Categoria Juvenil")& vbcrlf vbcrlf "Alojamiento " vbcrlf "Hotel " Request.form("Hotel") & vbcrlf "Albergue " Request.form("Albergue") & vbcrlf "Sin Alojamiento " Request.form("Sin Alojamiento") & vbcrlf vbcrlf "Visitas " vbcrlf "Terra Mitica " Request.form("Terra mitica") & vbcrlf "Parque Acuatico " Request.form("Parque Acuatico") & vbcrlf "Ciudad de las Ciencias " Request.form("Ciudad de las ciencias")
                 
                 
Mail.Host "elhost.com"
         
Mail.FromName Request.form("Nombre del Responsable")
         
Mail.From Request.form("E-Mail")
         
Mail.AddAddress "email@qrecibe"
         
Mail.Subject "Formulario Recibido de " Request.form("Nombre del Reponsable")
             
Mail.Body Mensaje
             On Error Resume Next
                      Mail
.Send
             
If Err <> 0 Then
               Response
.Write "Se ha producido un error: " err.Number Err.Description 
         End 
If                                    
%> 
__________________
webmaster de xematuning el mejor tuning español con más de 25000 fotos sobre el mundo del tuning, videos, salvapantallas, fondos y mucho más no lo dudes más y visítala!!!
  #2 (permalink)  
Antiguo 29/02/2004, 14:21
 
Fecha de Ingreso: febrero-2002
Ubicación: Valencia - España
Mensajes: 488
Antigüedad: 22 años, 2 meses
Puntos: 0
Ah por si os hace falta, este seria el "diseño" del formulario:

Código PHP:
 <form name="form1" action="/mail.asp" method="post">
                    <
b><font face="Arial, Helvetica, sans-serif">Nombre del Club:</font></b
                    <
input type="text" name="Nombre del Club" size="70" maxlength="70">
                    <
br>
                    <
b><font face="Arial, Helvetica, sans-serif">N&ordmde Equipos</font></b><br>
                    <
table width="350" border="0" cellspacing="0" cellpadding="0" align="center">
                      <
tr
                        <
td class="tres"> <div align="right">Categor&iacute;
                            Benjam
&iacute;
                            
<input type="text" name="Categoria Cadete3" size="1" maxlength="2">
                          </
div></td>
                        <
td class="tres"> <div align="right">Categor&iacute;
                            Cadete 
                            
<input type="text" name="Categoria Cadete" size="1" maxlength="2">
                          </
div></td>
                      </
tr>
                      <
tr
                        <
td class="tres"> <div align="right">Categor&iacute;
                            Alev
&iacute;
                            
<input type="text" name="Categoria Cadete2" size="1" maxlength="2">
                          </
div></td>
                        <
td class="tres"> <div align="right"> </div></td>
                      </
tr>
                      <
tr
                        <
td class="tres"> <div align="right">Categor&iacute;
                            Infantil 
                            
<input type="text" name="Categoria Infantil" size="1" maxlength="2">
                          </
div></td>
                        <
td class="tres"><div align="right">Categor&iacute;a Femenina 
                            
<input type="text" name="Categoria Femenina" size="1" maxlength="2">
                          </
div></td>
                      </
tr>
                    </
table>
                    <
br>
                    <
hr width="620">
                    <
br>
                    <
font size="2"><b><font face="Arial, Helvetica, sans-serif">NOMBRE 
                    DEL RESPONSABLE
:</font></b></font
                    <
input type="text" name="Nombre del Responsable" size="55" maxlength="55">
                    <
br>
                    <
font size="2"><b><font face="Arial, Helvetica, sans-serif">DIRECCI&Oacute;N:</font></b></font
                    <
input type="text" name="Direcci&oacute;n" size="74" maxlength="80">
                    <
br>
                    <
b><font face="Arial, Helvetica, sans-serif" size="2">TEL&Eacute;FONOS 
                    DE CONTACTO
:</font></b
                    <
input type="text" name="Telefonos" size="15" maxlength="25">
                    <
b><font face="Arial, Helvetica, sans-serif" size="2">E-MAIL:</font></b
                    <
input type="text" name="E-Mail" size="29" maxlength="30">
                    <
br>
                    <
b><font face="Arial, Helvetica, sans-serif" size="2">PREFERENCIAS:</font></b
                    <
br>
                    <
br>
                    <
table width="600" border="0" cellspacing="0" cellpadding="0" align="center">
                      <
tr
                        <
td width="96"><b><font face="Arial, Helvetica, sans-serif" size="2">ALOJAMIENTO</font><font face="Arial, Helvetica, sans-serif" size="1">:</font></b></td>
                        <
td width="128" class="tres"> <div align="right"
                            <
input type="checkbox" name="Hotel" value="checkbox">
                            
Hotel 3 estrellas</div></td>
                        <
td width="103" class="tres"> <div align="right"
                            <
input type="checkbox" name="Albergue" value="checkbox">
                            
Hotel 2 estrellas</div></td>
                        <
td width="173" class="tres"> <div align="right"
                            <
input type="checkbox" name="Sin Alojamiento" value="checkbox">
                            
Sin Alojamiento</div></td>
                      </
tr>
                      <
tr
                        <
td><b><font face="Arial, Helvetica, sans-serif" size="2">VISITAS:</font></b></td>
                        <
td class="tres"> <div align="right"
                            <
input type="checkbox" name="Terra Mitica" value="checkbox">
                            
Terra M&iacute;tica</div></td>
                        <
td class="tres"> <div align="right"
                            <
input type="checkbox" name="Parque Acuatico" value="checkbox">
                            
Parque Acu&aacute;tico</div></td>
                        <
td class="tres"> <div align="right"
                            <
input type="checkbox" name="Ciudad de las Ciencias" value="checkbox">
                            
Ciudad de las Ciencias</div></td>
                      </
tr>
                    </
table>
                    <
br>
                    <
center>
                      <
input type="submit" name="Submit" value="Enviar">
                      <
input type="reset" name="Submit" value="Borrar Formulario">
                    </
center>
                  </
form
__________________
webmaster de xematuning el mejor tuning español con más de 25000 fotos sobre el mundo del tuning, videos, salvapantallas, fondos y mucho más no lo dudes más y visítala!!!
  #3 (permalink)  
Antiguo 29/02/2004, 14:44
Avatar de Manoloweb  
Fecha de Ingreso: enero-2002
Ubicación: Monterrey
Mensajes: 2.454
Antigüedad: 22 años, 3 meses
Puntos: 5
Pues Nexus tiene una classe que hace lo mismo que tu script ASP...

http://nexus.nuestroweb.com
__________________
Manoloweb
  #4 (permalink)  
Antiguo 29/02/2004, 16:01
 
Fecha de Ingreso: febrero-2002
Ubicación: Valencia - España
Mensajes: 488
Antigüedad: 22 años, 2 meses
Puntos: 0
exactamente donde está?
porque pincho en scripts, y pone: "aqui irán los scripts"
en enlaces, lo mismo
en noticias, lo mismo
en contacto, lo mismo
y así con todas las secciones
:(
__________________
webmaster de xematuning el mejor tuning español con más de 25000 fotos sobre el mundo del tuning, videos, salvapantallas, fondos y mucho más no lo dudes más y visítala!!!
  #5 (permalink)  
Antiguo 29/02/2004, 18:43
Avatar de Manoloweb  
Fecha de Ingreso: enero-2002
Ubicación: Monterrey
Mensajes: 2.454
Antigüedad: 22 años, 3 meses
Puntos: 5
Je je... acabo de ver que su web está vacía...

Busca NEXUS Mail en el buscador de este foro y lo encontrarás.

__________________
Manoloweb
  #6 (permalink)  
Antiguo 29/02/2004, 18:58
 
Fecha de Ingreso: febrero-2002
Ubicación: Valencia - España
Mensajes: 488
Antigüedad: 22 años, 2 meses
Puntos: 0
pues no, ni por nexus, ni por nexus mail, me sale nada :(
__________________
webmaster de xematuning el mejor tuning español con más de 25000 fotos sobre el mundo del tuning, videos, salvapantallas, fondos y mucho más no lo dudes más y visítala!!!
  #7 (permalink)  
Antiguo 29/02/2004, 19:34
Avatar de Manoloweb  
Fecha de Ingreso: enero-2002
Ubicación: Monterrey
Mensajes: 2.454
Antigüedad: 22 años, 3 meses
Puntos: 5
Código PHP:
<?
/* **********************************************************************
 *
 *    Clase:            Nexus MIME Mail ('nxs_mimemail.inc.php')
 *    Version:            1.0
 *    Autor:            Alejandro Garcia Gonzalez <[email protected]>    
 *    Web:                [url]http://nexus.nuestroweb.com[/url]
 *
 * Descripcion:
 * Clase para poder enviar correos tipo MIME, con las siguientes
 * caracteristicas:
 *
 * + Solo Texto Plano
 * + HTML
 * + Texto Plano con adjuntos
 * + HTML con Adjuntos
 * + HTML con Imagenes Embebidas
 * + HTML con Imagenes Embebidas y Adjuntos
 * 
 * Esta clase esta desarrollada a partir de la exelente explicacion
 * encontrada en: [url]http://www.rinconastur.com/php/php64b.php[/url] 'Memorias
 * de un aprendiz' (Muchas Gracias). Lo demas fue revisando el codigo
 * fuente que genera Evolution ([url]www.ximian.com[/url]) y adaptarlo.
 *
 * ********************************************************************** */

class nxs_mimemail {
    
    
/* 
      * Variables Publicas
     * POR HACER: Depurar
     */
    
var $mail_from "Anonimo <[email protected]>";
    var 
$mail_to;
    var 
$mail_cc;
    var 
$mail_bcc;
    var 
$mail_subject "Sin Asunto";
    var 
$mail_text;
    var 
$mail_html;
    var 
$adjuntos_indice;
    var 
$adjuntos = array();
    var 
$adjuntos_img = array();
    var 
$separador_mix;
    var 
$seperador_rel;
    var 
$separador_alt;
    var 
$mail_type;
    var 
$cabecera;
    var 
$mensaje;
    var 
$msg_error "si";             // "si" | "no" | "halt"
   
var $tipos_mime = array(); 

    
/*
     * void nxs_mimemail();
     * Constructor.
     */
    
function nxs_mimemail(){
        
$this->separador_mix "=-nxs_mix_" md5(uniqid(rand()));
        
$this->separador_rel "=-nxs_rel_" md5(uniqid(rand()));
        
$this->separador_alt "=-nxs_alt_" md5(uniqid(rand()));
        
$this->adjuntos_indice 0;
        
$this->tipos_mime = array(
            
'gif'  => 'image/gif',
            
'jpg'  => 'image/jpeg',
            
'jpeg' => 'image/jpeg',
            
'jpe'  => 'image/jpeg',
            
'bmp'  => 'image/bmp',
            
'png'  => 'image/png',
            
'tif'  => 'image/tiff',
            
'tiff' => 'image/tiff',
            
'swf'  => 'application/x-shockwave-flash',
            
'doc'  => 'application/msword',
            
'xls'  => 'application/vnd.ms-excel',
            
'ppt'  => 'application/vnd.ms-powerpoint',
            
'pdf'  => 'application/pdf',
            
'ps'   => 'application/postscript',
            
'eps'  => 'application/postscript',
            
'rtf'  => 'application/rtf',
            
'bz2'  => 'application/x-bzip2',
            
'gz'   => 'application/x-gzip',
            
'tgz'  => 'application/x-gzip',
            
'tar'  => 'application/x-tar',
            
'zip'  => 'application/zip',
            
'html' => 'text/html',
            
'htm'  => 'text/html',
            
'txt'  => 'text/plain',
            
'css'  => 'text/css'
            
);

        if(!
defined('SALTO')){
            
define('SALTO'"\r\n"TRUE);
        }
    }

    
/*
     * void correo_de(string $mail_from, [string $nombre]);
     * Se asigna la direccion de correo del remitente. Opcionalmente
     * tambien se puede especificar el nombre del contacto.
     * $mail_from - Direccion de correo del remitente.
     * $nombre - Nombre del remitente (opcional).
     */
    
function correo_de($mail_from$nombre ""){
        if (
$this->valida_correo($mail_from)){
            if (!empty(
$nombre)){
                
$mail_from "$nombre <$mail_from>";
            }
            
$this->mail_from $mail_from;
        }
        else {
            
$this->mail_from "Anonimo <[email protected]>";
        }
    }

    
/*
     * bool agregar_para(string $mail_to, [string $nombre]);
     * Se asignan las direcciones de correos destino. Opcionalmente
     * tambien se puede especificar el nombre del contacto.
     * $mail_to - Direccion de correo destino.
     * $nombre - Nombre del correo destino (opcional).
     */
    
function agregar_para($mail_to$nombre ""){
        if (
$this->valida_correo($mail_to)){
            if (!empty(
$nombre)){
                
$mail_to "$nombre <$mail_to>";
            }
            if (empty(
$this->mail_to)){
                
$this->mail_to $mail_to;
                return 
true;
            }
            else {
                
$this->mail_to .= ", " $mail_to;
                return 
true;
            }
        }
        return 
false;
    }

    
/*
     * bool agregar_cc(string $mail_cc, [string $nombre]);
     * Se asignan las copias de correo destino. Opcionalmente
     * tambien se puede especificar el nombre del contacto.
     * $mail_cc - Direccion de copia de correo destino.
     * $nombre - Nombre del copia del correo destino (opcional).
     */
    
function agregar_cc($mail_cc$nombre ""){
        if (
$this->valida_correo($mail_cc)){
            if (!empty(
$nombre)){
                
$mail_cc "$nombre <$mail_cc>";
            }
            if (empty(
$this->mail_cc)){
                
$this->mail_cc $mail_cc;
                return 
true;
            }
            else {
                
$this->mail_cc .= ", " $mail_cc;
                return 
true;
            }
        }
        return 
false;
    }
    
    
/*
     * bool agregar_bcc(string $mail_bcc, [string $nombre]);
     * Se asignan las copias ocuptas de correo destino. Opcionalmente 
     * tambien se puede especificar el nombre del contacto.
     * $mail_bcc - Direccion de copia de correo destino.
     * $nombre - Nombre del correo destino (opcional).
     */
    
function agregar_bcc($mail_bcc$nombre ""){
        if (
$this->valida_correo($mail_bcc)){
            if (!empty(
$nombre)){
                
$mail_bcc "$nombre <$mail_bcc>";
            }
            if (empty(
$this->mail_bcc)){
                
$this->mail_bcc $mail_bcc;
                return 
true;
            }
            else {
                
$this->mail_bcc .= ", " $mail_bcc;
                return 
true;
            }
        }
        return 
false;
    }
    
    
/*
     * bool asunto(string $texto);
     * Se asigna el asunto del mensaje, en caso de no hacerlo
     * se asignara el asunto predeterminado.
     * $texto - Cadena de texto que va en el asunto.
     */
    
function asunto($texto){
        if (!empty(
$texto)){
            
$this->mail_subject $texto;
        }
    }

    
/*
     * void mensaje_texto(string $mensaje);
     * Se agrega el mensaje en texto plano.
     * $mensaje - Mensaje en texto plano.
     */
    
function mensaje_texto($mensaje){
        if (!empty(
$mensaje)){
            
$this->mail_text $mensaje;
        }
    }

    
/*
     * void mensaje_html(string $mensaje);
     * Se agrega el mensaje en html.
     * $mensaje - Mensaje en html.
     */
    
function mensaje_html($mensaje){
        if (!empty(
$mensaje)){
            
$this->mail_html $mensaje;
        }
    }

    
/*
     * void crear_correo([string $de], [string $para], [string $asunto], [string $texto], [string $html]);
     * Esta funcion se encarga de hacer un poco mas rapida la inclusion de
     * los datos basicos que se requieren para armar un correo.
     * Este solo es un atajo. Todos los valores son opcionales.
     * $de - Direccion de correo del remitente
     * $para - Direccion de correo del destinatario
     * $texto - Mensaje en Texto Plano
     * $html - Mensaje en formato HTML
     */
    
function crear_correo($de ""$para ""$asunto ""$texto ""$html ""){
        
$this->correo_de($de);
        
$this->correo_para($para);
        
$this->asunto($asunto);
        
$this->mensaje_texto($texto);
        
$this->mensaje_html($html);
    }
    
    
/* 
     * void agregar_adjunto(mixed $archivo, string $nombre, [string $tipo]);
     * Funcion para agregar archivos adjuntos al correo.
     * $archivo - Resultado del fopen del archivo.
     * $tipo - Tipo del archivo, predeterminadamente "application/octet-stream".
     * $nombre - Nombre del archivo.
     */
    
function agregar_adjunto($archivo$nombre$tipo ""){
        if (empty(
$tipo)){$tipo $this->revisar_mime($nombre);}
        
$this->adjuntos[$this->adjuntos_indice][archivo] = chunk_split(base64_encode($archivo));
        
$this->adjuntos[$this->adjuntos_indice][nombre] = $nombre;
        
$this->adjuntos[$this->adjuntos_indice][tipo] = $tipo;
        
$this->adjuntos[$this->adjuntos_indice][embebido] = false;
        
$this->adjuntos_indice++;
    }

    
/*
     * void armar_cabecera();
     * Funcion encargada de armar la cabecera del correo.
     */
    
function armar_cabecera($content_type){
        
$this->cabecera "MIME-Version: 1.0" SALTO;
        if (!empty(
$this->mail_from)){
            
$this->cabecera .= "Wrom: ZUIVOTQNQEMSFDULHPQQWOYIYZUNN
            $this->cabecera .= "
Reply-To" . $this->mail_from . SALTO;
        }
        if (!empty($this->mail_cc)){
            $this->cabecera .= "
Cc" . $this->mail_cc . SALTO;
        }    
        if (!empty($this->mail_bcc)){
            $this->cabecera .= "
Bcc" . $this->mail_bcc . SALTO;
        }
        $this->cabecera .= "
X-MailerneXus MIME Mail PHP/". phpversion() . SALTO;
        $this->cabecera .= $content_type . SALTO . SALTO;
    }
... CONTINUA...
__________________
Manoloweb
  #8 (permalink)  
Antiguo 29/02/2004, 19:37
Avatar de Manoloweb  
Fecha de Ingreso: enero-2002
Ubicación: Monterrey
Mensajes: 2.454
Antigüedad: 22 años, 3 meses
Puntos: 5
Código PHP:
    
    
/*
     * bool enviar();
     * Arma el correo dependiendo de las caracteristicas que se hayan
     * includo con exito en esta clase. Se puede armar 6 tipos 
     * diferentes de correos, para mas informacion puede consultar la 
     * documentacion de esta clase.
     */
    
function enviar(){
        
$this->revisar_tipo();
        switch (
$this->mail_type){
            case 
1:
                
$this->armar_cabecera("Content-Type: text/plain");
                
$this->mensaje $this->mail_text;
                break;
            case 
3:
                
$this->armar_cabecera("Content-Type: multipart/alternative; boundary=\"$this->separador_alt\"");
                
$this->mensaje .= "--" $this->separador_alt SALTO;
                
$this->mensaje .= "Content-Type: text/plain" SALTO;
                
$this->mensaje .= "Content-Transfer-Encoding: 7bit" SALTO SALTO;
                
$this->mensaje .= $this->mail_text SALTO SALTO;
                
$this->mensaje .= "--" $this->separador_alt SALTO;
                
$this->mensaje .= "Content-Type: text/html; charset=\"ISO-8859-1\"" SALTO;
                
$this->mensaje .= "Content-Transfer-Encoding: 7bit" SALTO SALTO;
                
$this->mensaje .= $this->mail_html SALTO SALTO;
                
$this->mensaje .= "--" $this->separador_alt "--" SALTO;
                break;
            case 
5:
                
$this->armar_cabecera("Content-Type: multipart/mixed; boundary=\"$this->separador_mix\"");
                
$this->mensaje .= "--" $this->separador_mix SALTO;
                
$this->mensaje .= "Content-Type: text/plain" SALTO;
                
$this->mensaje .= "Content-Transfer-Encoding: 7bit" SALTO SALTO;
                
$this->mensaje .= $this->mail_text SALTO SALTO;
                foreach(
$this->adjuntos as $key => $valor){
                    
$this->mensaje .= "--" $this->separador_mix SALTO;
                    
$this->mensaje .= "Content-Disposition: attachment; filename=" $this->adjuntos[$key][nombre] . SALTO;
                    
$this->mensaje .= "Content-Type: " $this->adjuntos[$key][tipo] . "; name=" $this->adjuntos[$key][nombre] . SALTO;
                    
$this->mensaje .= "Content-Transfer-Encoding: base64" SALTO SALTO;
                    
$this->mensaje .= $this->adjuntos[$key][archivo] . SALTO SALTO;
                }
                
$this->mensaje .= "--" $this->separador_mix "--" SALTO;
                break;
            case 
7:
                
$this->armar_cabecera("Content-Type: multipart/mixed; boundary=\"$this->separador_mix\"");
                
$this->mensaje .= "--" $this->separador_mix SALTO;
                
$this->mensaje .= "Content-Type: multipart/alternative; boundary=\"$this->separador_alt\"" SALTO SALTO;
                
$this->mensaje .= "--" $this->separador_alt SALTO;
                
$this->mensaje .= "Content-Type: text/plain" SALTO;
                
$this->mensaje .= "Content-Transfer-Encoding: 7bit" SALTO SALTO;
                
$this->mensaje .= $this->mail_text SALTO SALTO;
                
$this->mensaje .= "--" $this->separador_alt SALTO;
                
$this->mensaje .= "Content-Type: text/html; charset=\"ISO-8859-1\"" SALTO;
                
$this->mensaje .= "Content-Transfer-Encoding: 7bit" SALTO SALTO;
                
$this->mensaje .= $this->mail_html SALTO SALTO;
                
$this->mensaje .= "--" $this->separador_alt "--" SALTO SALTO;
                foreach(
$this->adjuntos as $key => $valor){
                    
$this->mensaje .= "--" $this->separador_mix SALTO;
                    
$this->mensaje .= "Content-Disposition: attachment; filename=" $this->adjuntos[$key][nombre] . SALTO;
                    
$this->mensaje .= "Content-Type: " $this->adjuntos[$key][tipo] . "; name=" $this->adjuntos[$key][nombre] . SALTO;
                    
$this->mensaje .= "Content-Transfer-Encoding: base64" SALTO SALTO;
                    
$this->mensaje .= $this->adjuntos[$key][archivo] . SALTO SALTO;
                }
                
$this->mensaje .= "--" $this->separador_mix "--" SALTO;
                break;
            case 
11:
                
$this->armar_cabecera("Content-Type: multipart/related; type=\"multipart/alternative\"; boundary=\"$this->separador_rel\"");
                
$this->mensaje .= "--" $this->separador_rel SALTO;
                
$this->mensaje .= "Content-Type: multipart/alternative; boundary=\"$this->separador_alt\"" SALTO SALTO;
                
$this->mensaje .= "--" $this->separador_alt SALTO;
                
$this->mensaje .= "Content-Type: text/plain" SALTO;
                
$this->mensaje .= "Content-Transfer-Encoding: 7bit" SALTO SALTO;
                
$this->mensaje .= $this->mail_text SALTO SALTO;
                
$this->mensaje .= "--" $this->separador_alt SALTO;
                
$this->mensaje .= "Content-Type: text/html; charset=\"ISO-8859-1\"" SALTO;
                
$this->mensaje .= "Content-Transfer-Encoding: 7bit" SALTO SALTO;
                
$this->mensaje .= $this->mail_html SALTO SALTO;
                
$this->mensaje .= "--" $this->separador_alt "--" SALTO SALTO;
                foreach(
$this->adjuntos as $key => $valor){
                    if (
$this->adjuntos[$key][embebido]){
                        
$this->mensaje .= "--" $this->separador_rel SALTO;
                        
$this->mensaje .= "Content-ID: <" $this->adjuntos[$key][embebido] . ">" SALTO;
                        
$this->mensaje .= "Content-Disposition: attachment; filename=" $this->adjuntos[$key][nombre] . SALTO;
                        
$this->mensaje .= "Content-Type: " $this->adjuntos[$key][tipo] . "; name=" $this->adjuntos[$key][nombre] . SALTO;
                        
$this->mensaje .= "Content-Transfer-Encoding: base64" SALTO SALTO;
                        
$this->mensaje .= $this->adjuntos[$key][archivo] . SALTO SALTO;
                    }
                }
                
$this->mensaje .= "--" $this->separador_rel "--" SALTO;
                break;
            case 
15:
                
$this->armar_cabecera("Content-Type: multipart/mixed; boundary=\"$this->separador_mix\"");
                
$this->mensaje .= "--" $this->separador_mix SALTO;
                
$this->mensaje .= "Content-Type: multipart/related; type=\"multipart/alternative\"; boundary=\"$this->separador_rel\"" SALTO SALTO;
                
$this->mensaje .= "--" $this->separador_rel SALTO;
                
$this->mensaje .= "Content-Type: multipart/alternative; boundary=\"$this->separador_alt\"" SALTO SALTO;
                
$this->mensaje .= "--" $this->separador_alt SALTO;
                
$this->mensaje .= "Content-Type: text/plain" SALTO;
                
$this->mensaje .= "Content-Transfer-Encoding: 7bit" SALTO SALTO;
                
$this->mensaje .= $this->mail_text SALTO SALTO;
                
$this->mensaje .= "--" $this->separador_alt SALTO;
                
$this->mensaje .= "Content-Type: text/html; charset=\"ISO-8859-1\"" SALTO;
                
$this->mensaje .= "Content-Transfer-Encoding: 7bit" SALTO SALTO;
                
$this->mensaje .= $this->mail_html SALTO SALTO;
                
$this->mensaje .= "--" $this->separador_alt "--" SALTO SALTO;
                foreach(
$this->adjuntos as $key => $valor){
                    if (
$this->adjuntos[$key][embebido]){
                        
$this->mensaje .= "--" $this->separador_rel SALTO;
                        
$this->mensaje .= "Content-ID: <" $this->adjuntos[$key][embebido] . ">" SALTO;
                        
$this->mensaje .= "Content-Disposition: attachment; filename=" $this->adjuntos[$key][nombre] . SALTO;
                        
$this->mensaje .= "Content-Type: " $this->adjuntos[$key][tipo] . "; name=" $this->adjuntos[$key][nombre] . SALTO;
                        
$this->mensaje .= "Content-Transfer-Encoding: base64" SALTO SALTO;
                        
$this->mensaje .= $this->adjuntos[$key][archivo] . SALTO SALTO;
                    }
                }
                
$this->mensaje .= "--" $this->separador_rel "--" SALTO SALTO;
                foreach(
$this->adjuntos as $key => $valor){
                    if (!
$this->adjuntos[$key][embebido]){
                        
$this->mensaje .= "--" $this->separador_mix SALTO;
                        
$this->mensaje .= "Content-Disposition: attachment; filename=" $this->adjuntos[$key][nombre] . SALTO;
                        
$this->mensaje .= "Content-Type: " $this->adjuntos[$key][tipo] . "; name=" $this->adjuntos[$key][nombre] . SALTO;
                        
$this->mensaje .= "Content-Transfer-Encoding: base64" SALTO SALTO;
                        
$this->mensaje .= $this->adjuntos[$key][archivo] . SALTO SALTO;
                    }
                }
                
$this->mensaje .= "--" $this->separador_mix "--" SALTO;
                break;
            default:
                return 
false;
        }
        if (
mail($this->mail_to$this->mail_subject$this->mensaje,$this->cabecera)){
            return 
true;
        }
        return 
false;
    } 
__________________
Manoloweb
  #9 (permalink)  
Antiguo 29/02/2004, 19:41
Avatar de Manoloweb  
Fecha de Ingreso: enero-2002
Ubicación: Monterrey
Mensajes: 2.454
Antigüedad: 22 años, 3 meses
Puntos: 5
Código PHP:
    /*
     * bool revisar_tipo();
     * Funcion encargada de revisar que los contenidos y caracteristicas
     * del correo sean validas.
     */
    
function revisar_tipo(){
        if (empty(
$this->mail_to)){
            
$this->debug("No existe una direccion de destinatario");
            return 
false;
        }
        
$this->mail_type 0;
        
$this->buscar_imagenes();
        if (!empty(
$this->mail_text)){
            
$this->mail_type $this->mail_type 1;
        }
        if (!empty(
$this->mail_html)){
            
$this->mail_type $this->mail_type 2;
            if (empty(
$this->mail_text)){
                
$this->mail_text strip_tags(eregi_replace("<br>"SALTO$this->mail_html));
                
$this->mail_type $this->mail_type 1;
            }
        }
        if (
$this->adjuntos_indice != 0){
            if (
count($this->adjuntos_img) != 0){
                
$this->mail_type $this->mail_type 8;
            }
            if ((
count($this->adjuntos) - count($this->adjuntos_img)) >= 1){
                
$this->mail_type $this->mail_type 4;
            }
        }
        return 
true;
    }

    
/*
     * void buscar_imagenes();
     * Se encarga de encontrar (si existen) imagenes embebidas en html
     */
    
function buscar_imagenes(){
        if (
$this->adjuntos_indice != 0){
            foreach(
$this->adjuntos as $key => $valor){
                if (
eregi('image'$this->adjuntos[$key][tipo]) && eregi('<img.*src=[\"|\'](' $this->adjuntos[$key][nombre] . ')[\"|\'].*>'$this->mail_html)){
                    
$img_id md5($this->adjuntos[$key][nombre]) . ".nxs@mimemail";
                    
$this->mail_html eregi_replace('(<img.*src=[\"|\'])(' $this->adjuntos[$key][nombre] . ')([\"|\'].*>)''\\1cid:' $img_id '\\3'$this->mail_html);
                    
$this->adjuntos[$key][embebido] = $img_id;
                    
$this->adjuntos_img[] = $this->adjuntos[$key][nombre];
                }
            }
        }
    }
    
    
/*
     * bool valida_correo(string $correo);
     * Funcion encargada de validar si la direccion de correo es
     * valida 'sintacticamente'
     */
    
function valida_correo($correo){
        if (
ereg('^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'.'@'.'[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'.'[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$',$correo)){
            return 
true;
        }
        
$this->debug("Correo no válido sintacticamente ($correo)");
        return 
false;
    }

    
/*
     * string revisar_mime(string $nombre);
     * Funcion que trata de determinar el tipo MIME por el nombre
     * de archivo mandado, en caso de no encontrar se regresa el
     * predeterminado
     */
    
function revisar_mime($nombre){
        
$ext_array explode("."$nombre);
        if ((
$ultimo count($ext_array) - 1) != 0){
            
$ext $ext_array[$ultimo];
            foreach(
$this->tipos_mime as $key => $valor){
                if (
$ext == $key){
                    return 
$valor;
                }
            }
        }
        return 
"application/octet-stream";
    }
    
    
/*
     * int abrir_archivo(string $archivo);
     * Abre el contenido de una archivo y lo devuelve
     * $archivo - Ruta donde se encuentra el archivo a abrir
     */
    
function abrir_archivo($archivo){
        if(
$fp fopen($archivo'r')){
            
$regresar fread($fpfilesize($archivo));
            
fclose($fp);
            return 
$regresar;
        }
        return 
false;
    } 

    
/*
     * void debug(string $msg);
     * Funcion para el manejo de errores de la clase.
     */
    
function debug($msg){
        if (
$this->msg_error == "si"){
            echo 
"<br><b>Error:</b> " $msg "<br>";
        }
        elseif (
$this->msg_error == "halt"){
            die (
"<br><b>Error:</b> " $msg "<br>");
        }
        return 
false;
    }

}
?> 



BUENO, AQUI TERMINA EL ARCHIVO!!!!


PERO NO TE ASUSTES, ESTO ES SOLO LA CLASE QUE SE ENCARGA DE SIMULAR LO QUE TU TIENES.

Basta con que guardes todo eso en un archivo llamado

nxs_mimemail.inc.php

Y lo usuas así...

Código PHP:
include ("nxs_mimemail.inc.php");
$correo=new nxs_mimemail;
$correo->asunto("Promocion para ".$nombreempresa);
$correo->correo_de("[email protected]""Nombre");
$correo->agregar_para("[email protected]");
$correo->agregar_cc("[email protected]");
$correo->mensaje_texto($mensajeTXT);
$correo->mensaje_html($mensajeHTML);
$correo->enviar(); 
Y listo!!!
__________________
Manoloweb
  #10 (permalink)  
Antiguo 29/02/2004, 20:42
 
Fecha de Ingreso: febrero-2002
Ubicación: Valencia - España
Mensajes: 488
Antigüedad: 22 años, 2 meses
Puntos: 0
ok, muchas gracias, voy a revisarlo a ver....
__________________
webmaster de xematuning el mejor tuning español con más de 25000 fotos sobre el mundo del tuning, videos, salvapantallas, fondos y mucho más no lo dudes más y visítala!!!
  #11 (permalink)  
Antiguo 29/02/2004, 20:46
 
Fecha de Ingreso: febrero-2002
Ubicación: Valencia - España
Mensajes: 488
Antigüedad: 22 años, 2 meses
Puntos: 0
no entiendo muy bien como aplicarlo, a mi formulario, me podrias indicar donde iria el include, es decir como quedaria mi formulario al final?????
__________________
webmaster de xematuning el mejor tuning español con más de 25000 fotos sobre el mundo del tuning, videos, salvapantallas, fondos y mucho más no lo dudes más y visítala!!!
  #12 (permalink)  
Antiguo 29/02/2004, 20:54
Avatar de Manoloweb  
Fecha de Ingreso: enero-2002
Ubicación: Monterrey
Mensajes: 2.454
Antigüedad: 22 años, 3 meses
Puntos: 5
Pues debes primero crear un archivo para procesar los correos, tal como lo tienes ahora en ASP...

mail.php <-- Aqui incluyes y generas el mail

Y en tu formulario cambias el action:

<form name="form1" action="/mail.php" method="post">

El funcionamiento es muy parecido a lo que tenías en ASP


__________________
Manoloweb
  #13 (permalink)  
Antiguo 01/03/2004, 04:11
 
Fecha de Ingreso: febrero-2002
Ubicación: Valencia - España
Mensajes: 488
Antigüedad: 22 años, 2 meses
Puntos: 0
manoloweb, a partir de esta línea ya me aparece todo en rojo, y me dice que el código está incorrecto. mira a ver que está mal por favor.

Código PHP:
if (eregi('image'$this->adjuntos[$key][tipo]) && eregi('<img.*src=[\"|'](' . $this->adjuntos[$key][nombre] . ')["|'].*>', $this->mail_html)){
                    $img_id = md5($this->adjuntos[$key][nombre]) . "
.nxs@mimemail";
                    $this->mail_html = eregi_replace('(<img.*src=[\"|'])(' . $this->adjuntos[$key][nombre] . ')([\"|'].*> )', '\1cid:' . $img_id . '\3', $this->mail_html);
                    $this->adjuntos[$key][embebido] = $img_id;
                    $this->adjuntos_img[] = $this->adjuntos[$key][nombre];
                }
            }
        }
    }
    
    /*
     * bool valida_correo(string $correo);
     * Funcion encargada de validar si la direccion de correo es
     * valida 'sintacticamente'
     */
    function valida_correo($correo){
        if (ereg('^[-!#$%&'*+\./0-9=?A-Z^_`a-z{|}~]+'.'@'.'[-!#$%&'*+\/0-9=?A-Z^_`a-z{|}~]+.'.'[-!#$%&'*+\./0-9=?A-Z^_`a-z{|}~]+$',$correo)){
            return true;
        }
        $this->debug("
Correo no válido sintacticamente ($correo)");
        return false;
    }

    /*
     * string revisar_mime(string $nombre);
     * Funcion que trata de determinar el tipo MIME por el nombre
     * de archivo mandado, en caso de no encontrar se regresa el
     * predeterminado
     */
    function revisar_mime($nombre){
        $ext_array = explode("
.", $nombre);
        if (($ultimo = count($ext_array) - 1) != 0){
            $ext = $ext_array[$ultimo];
            foreach($this->tipos_mime as $key => $valor){
                if ($ext == $key){
                    return $valor;
                }
            }
        }
        return "
application/octet-stream";
    }
    
    /*
     * int abrir_archivo(string $archivo);
     * Abre el conteni??do de una archivo y lo devuelve
     * $archivo - Ruta donde se encuentra el archivo a abrir
     */
    function abrir_archivo($archivo){
        if($fp = fopen($archivo, 'r')){
            $regresar = fread($fp, filesize($archivo));
            fclose($fp);
            return $regresar;
        }
        return false;
    } 

    /*
     * void debug(string $msg);
     * Funcion para el manejo de errores de la clase.
     */
    function debug($msg){
        if ($this->msg_error == "
si"){
            echo "
<br><b>Error:</b" . $msg . "<br>";
        }
        elseif ($this->msg_error == "
halt"){
            die ("
<br><b>Error:</b" . $msg . "<br>");
        }
        return false; 
__________________
webmaster de xematuning el mejor tuning español con más de 25000 fotos sobre el mundo del tuning, videos, salvapantallas, fondos y mucho más no lo dudes más y visítala!!!
  #14 (permalink)  
Antiguo 01/03/2004, 10:18
Avatar de Manoloweb  
Fecha de Ingreso: enero-2002
Ubicación: Monterrey
Mensajes: 2.454
Antigüedad: 22 años, 3 meses
Puntos: 5
Cambia esa linea por esto:

if (eregi('image', $this->adjuntos[$key][tipo]) && eregi('<img.*src=[\"|\'](' . $this->adjuntos[$key][nombre] . ')[\"|\'].*>', $this->mail_html)){

Y mas abajo esta otra que puede dar problemas, que debería decir así:

if (ereg('^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'.'@'.'[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'.'[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$',$correo)){
__________________
Manoloweb
  #15 (permalink)  
Antiguo 02/03/2004, 06:58
 
Fecha de Ingreso: febrero-2002
Ubicación: Valencia - España
Mensajes: 488
Antigüedad: 22 años, 2 meses
Puntos: 0
mira me sigue saliendo mal, con esos cambios y todo:

Código PHP:
*
     * 
void buscar_imagenes();
     * 
Se encarga de encontrar (si existenimagenes embebidas en html
     
*/
    function 
buscar_imagenes(){
        if (
$this->adjuntos_indice != 0){
            foreach(
$this->adjuntos as $key => $valor){
             
                if (
eregi('image'$this->adjuntos[$key][tipo]) && eregi('<img.*src=[\"|'](' . $this->adjuntos[$key][nombre] . ')["|'].*>', $this->mail_html)){

                    $img_id = md5($this->adjuntos[$key][nombre]) . "
.nxs@mimemail";
                    $this->mail_html = eregi_replace('(<img.*src=[\"|'])(' . $this->adjuntos[$key][nombre] . ')([\"|'].*> )', '\1cid:' . $img_id . '\3', $this->mail_html);
                    $this->adjuntos[$key][embebido] = $img_id;
                    $this->adjuntos_img[] = $this->adjuntos[$key][nombre];
                }
            }
        }
    }
    
    /*
     * bool valida_correo(string $correo);
     * Funcion encargada de validar si la direccion de correo es
     * valida 'sintacticamente'
     */
    function valida_correo($correo){
        if (ereg('^[-!#$%&'*+\\./0-9=?A-Z^_`a-z{|}~]+'.'@'.'[-!#$%&'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'.'[-!#$%&'*+\\./0-9=?A-Z^_`a-z{|}~]+$',$correo)){
                return true;
        }
        $this->debug("
Correo no válido sintacticamente ($correo)");
        return false;
    }

    /*
     * string revisar_mime(string $nombre);
     * Funcion que trata de determinar el tipo MIME por el nombre
     * de archivo mandado, en caso de no encontrar se regresa el
     * predeterminado
     */
    function revisar_mime($nombre){
        $ext_array = explode("
.", $nombre);
        if (($ultimo = count($ext_array) - 1) != 0){
            $ext = $ext_array[$ultimo];
            foreach($this->tipos_mime as $key => $valor){
                if ($ext == $key){
                    return $valor;
                }
            }
        }
        return "
application/octet-stream";
    }
    
    /*
     * int abrir_archivo(string $archivo);
     * Abre el contenido de una archivo y lo devuelve
     * $archivo - Ruta donde se encuentra el archivo a abrir
     */
    function abrir_archivo($archivo){
        if($fp = fopen($archivo, 'r')){
            $regresar = fread($fp, filesize($archivo));
            fclose($fp);
            return $regresar;
        }
        return false;
    } 

    /*
     * void debug(string $msg);
     * Funcion para el manejo de errores de la clase.
     */
    function debug($msg){
        if ($this->msg_error == "
si"){
            echo "
<br><b>Error:</b" . $msg . "<br>";
        }
        elseif ($this->msg_error == "
halt"){
            die ("
<br><b>Error:</b" . $msg . "<br>");
        }
        return false;
    }

}
?> 
__________________
webmaster de xematuning el mejor tuning español con más de 25000 fotos sobre el mundo del tuning, videos, salvapantallas, fondos y mucho más no lo dudes más y visítala!!!
  #16 (permalink)  
Antiguo 02/03/2004, 09:02
Avatar de Manoloweb  
Fecha de Ingreso: enero-2002
Ubicación: Monterrey
Mensajes: 2.454
Antigüedad: 22 años, 3 meses
Puntos: 5
Mandame tu email en un Mensaje Privado y te mando el archivo mejor
__________________
Manoloweb
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 19:25.