textboundary = uniqid(time()); $this->emailboundary = uniqid(time()); $this->charset = "ISO-8859-1"; } // la fonction de traduction des caractères function SetCharSet($char) { $this->charset = $char; } //initialisation de l'émeteur function from($name,$email) { $this->emailheader .= "From: ".$name."<".$email.">\n"; $this->createur = "-F $email"; } //la prise en compte des destinataires individuels (tranformé en tableau-array) function to($to) { $this->empfaenger[] = $to; } // la prise en compte des destinataires Cc function cc($kopie_an_empfaenger) { $this->cc[] = $kopie_an_empfaenger; } // la prise en compte des destinataires Bcc function bcc($kopie_an_empfaenger) { $this->bcc[] = $kopie_an_empfaenger; } // intégration des destinataires Cc et-ou Bcc dans le Header Mime-Mail function makeMimeMail() { if(count($this->cc) > 0) { $this->emailheader .= "Cc: "; for($i=0;$icc);$i++) { if($i > 0) $this->emailheader .= ","; $this->emailheader .= $this->cc[$i]; } $this->emailheader .= "\n"; } if(count($this->bcc) > 0) { $this->emailheader .= "Bcc: "; for($j=0;$jbcc);$j++) { if($j > 0) $this->emailheader .= ","; $this->emailheader .= $this->bcc[$j]; } $this->emailheader .= "\n"; } // la balise MIME-Version: 1.0\nContent-Type: multipart/mixed; boundary a été mise dans le emailheader $this->emailheader .= "MIME-Version: 1.0\nContent-Type: multipart/mixed;\n\tboundary=\"".$this->emailboundary."\"\r\n"; } // prise en compte de l'objet du message function subject($subject) { $this->betreff = $subject; } // intégration du texte du message dans le Header et crétion du double en html function text($text) { $this->textheader .= "Content-Type: multipart/alternative; \n\tboundary=\"".$this->textboundary."\"\n"; $this->textheader .= "--".$this->textboundary."\n"; $this->textheader .= "Content-Type: text/plain; charset=\"".$this->charset."\"\n"; $this->textheader .= "Content-Transfer-Enconding: quoted-printable\n"; $this->textheader .= strip_tags($text)."\n"; $this->textheader .= "--".$this->textboundary."\n"; $this->textheader .= "Content-Type: text/html; charset=\"".$this->charset."\"\n"; $this->textheader .= "Content-Transfer-Enconding: quoted-printable\n"; $this->textheader .= "\n"; $this->textheader .= "\n".str_replace("\r\n","
",$text)."\n"; $this->textheader .= "--".$this->textboundary."--\n"; } // prise en compte des fichiers attachés-joints au message function attachment($datei) { // vérification de l'existence du fichier if(is_file($datei)) { // création de l'entète de l'attachement $attachment_header = "--".$this->emailboundary."\n" ; $attachment_header .= "Content-Type: application/octet-stream;\n name=\"".$this->GetFileName($datei)."\"\n"; $attachment_header .= "Content-Transfer-Encoding: base64\n"; $attachment_header .= "Content-Disposition: attachment;\n filename=\"".$this->GetFileName($datei)."\"\n\n"; // transcodage BASE64 et formatage 72 caractères par ligne // aufteilen $file['inhalt'] = fread(fopen($datei,"rb"),filesize($datei)); $file['inhalt'] = base64_encode($file['inhalt']); $file['inhalt'] = chunk_split($file['inhalt'],72); //intégration de la mise en forme dans la variable idoine $this->attachment[] = $attachment_header.$file['inhalt']."\n"; } else { //echo "Ce document $datei n'existe pas\n"; } } // traitement de l'adresse absolue du fichier function GetFileName($PathWithFile) { if(preg_match("/\//i",$PathWithFile)) { return substr(strrchr($PathWithFile,"/"),1); } else { return $PathWithFile; } } // mise en forme du Header des E-mail // expédition des e-mail function send() { $this->makeMimeMail(); $header = $this->emailheader; // ajout des différents attachements pris en compte if(count($this->attachment)>0) { // $header .= "Content-Type: multipart/mixed;\n\tboundary=\"".$this->emailboundary."\"\n"; $header .= "--".$this->emailboundary."\n"; $header .= $this->textheader; if(count($this->attachment) > 0) $header .= implode("",$this->attachment); $header .= "--$this->emailboundary--"; } else { $header .= $this->textheader; } if(count($this->empfaenger) >0) { foreach($this->empfaenger as $pour) { mail("$pour",$this->betreff,"",$header,"$this->createur"); //echo "envoi fait pour ".$pour."
"; } } else { mail("$this->empfaenger",$this->betreff,"",$header,"$this->createur"); //echo "envoi fait pour ".$this->empfaenger; } $this->deletememory(); } function deletememory() { unset($this->emailheader); unset($this->textheader); unset($this->attachment); } } ?> Fathi Kemicha, International Lawyer & Arbitrator
Fathi Kemicha, International Lawyer & Arbitrator
Fathi Kemicha, International Lawyer & Arbitrator Fathi Kemicha, International Lawyer & Arbitrator Fathi Kemicha, International Lawyer & Arbitrator Fathi Kemicha, International Lawyer & Arbitrator
Fathi Kemicha, International Lawyer & Arbitrator

Latest news



Fathi Kemicha, International Lawyer & Arbitrator