Datuve :: Forums :: Arhīvs :: PHP Mailing

Datuve

Mana Datuve

Reģistrācija | Noteikumi | Paroles atjaunošana



Forums

Ieskaties


Raksti

Lietotāji online

Lietotāji online: 114

Reģistrētie lietotāji online: 0

Viesi online: 114

Datuve.lv video
Top.LV

PHP Mailing

Ievietoja: Mikijs[c4] @ 2008.05.06 12:57  

Sveiki, esmu nonacis nesaprasana.
Izmantoju Postaci Webmail (PHP). Šis webmails, tā pat kā citi zināmiem e-pasta klienti webā izmanto "Mime_Mail" bibliotēku. Līdz šim nebiju ievērojis vienu nepilnību, kuru vēlētos labot, jo tas kļūst kaitiņoši.

- Sastādot e-pastu es norādu saņēmēju, tematu, tekstu un pielikumus.
- Vēstuli nosūtot saņēmēja galā parādas vēstule, temats, teksts un pielikumi, bet teksta veidā

Shēma ir aptuveni šāda

From: test@localhost
Subject: test msg
-----------------------------------------------
My msg tekst my msg tekst my msg tekst my msg tekst my msg tekst my msg tekst my msg tekst my msg tekst my msg tekst my msg tekst my msg tekst my msg tekst my msg tekst my msg tekst my msg tekst my msg tekst my msg tekst my msg tekst my msg tekst my msg tekst my msg tekst my msg tekst my msg tekst my msg tekst
-----------------------------------------------
Un seit radas manu pielikumu saturs



Kā lai es dabūnu lai man netiktu rādīts šis saturs ?
Lūk vizuāls paraugs
http://mikijs.times.lv/msg020202.JPG

Un šeit varu vēl ielikt kā tiek pievienoti attačhi un klases sadaļu kur ir par atačiem.

fails1.php


   while ($file = readdir($handle)) {
     $idvar = strstr($file,$ID);
     if ($idvar) {
       $attachedfile = $file;
       $attach_name  = substr($attachedfile,6);

       // Find the MIME type from th extension...
       $tersname = strrev($attach_name);
       $dosya_isim = stristr($tersname,".");
       $lenisim = strlen($dosya_isim);
       $extension=trim(strtolower(substr($attach_name,$lenisim)));

       $mime_type = "application/octet-stream";
       $dbq = $db->execute("select mime_type from tblMIME where mime_ext = '$extension'");
       $mime_type = $dbq->fields['mime_type'];
       $dbq->close();

       // adding the attachments.
       $fd = fopen($attach_directory . $file, "r");
       $data = fread($fd, filesize($attach_directory . $file));
       fclose($fd);

       $size = $size + filesize($attach_directory . $file);
       $size = round(($size/1024));
       $mail->add_attachment($data, $attach_name, $mime_type);
     }
   }

Fails2.php - Mime Blibliotēka


  function add_attachment($message, $name, $ctype) {
     $this->parts[] = array ("ctype"   => $ctype,
                             "message" => $message,
                             "encode"  => $encode,
                             "name"    => $name);
  }
  function build_message($part) {
     $message = $part[ "message"];
     $message = chunk_split(base64_encode($message));
     $encoding =  "base64";
     return  "Content-Type: ".$part[ "ctype"].
        ($part[ "name"]? "; name = \"".$part[ "name"].
        "\"" :  "").

        "\nContent-Transfer-Encoding: $encoding\n\n$message\n";
  }
  function build_multipart() {
     $boundary =  "b".md5(uniqid(time()));
     $multipart =
        "Content-Type: multipart/mixed; boundary = $boundary\n\nThis is a MIME encoded message.\n\n--$boundary";

        for($i = sizeof($this->parts)-1; $i >= 0; $i--)
     {
        $multipart .=  "\n".$this->build_message($this->parts[$i]).
           "--$boundary";
     }
     return $multipart.=  "--\n";
  }

Būtu ļoti pateicīgs ja kāds varētu palīdzēt!