Ver Mensaje Individual
  #8 (permalink)  
Antiguo 29/02/2004, 19:37
Avatar de Manoloweb
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