type = $type; $this->headers .= "From: " . $from . "\n"; $this->headers .= "Reply-to: " . $replyto . "\n"; $this->headers .= "X-Mailer: " . $this->xMailer . "\n"; $this->headers .= "MIME-Version: 1.0\n"; if ($type == 1) { // text/plain $this->headers .= "Content-Type: text/plain; charset=iso-8859-2\n"; } else { srand((double)microtime() * 1000000); $this->marker = md5(uniqid(rand())); $this->headers .= "Content-Type: multipart/mixed;\n"; $this->headers .= "\tboundary=\"___" . $this->marker . "==\"\n\n"; $this->content = "--___" . $this->marker . "==\n"; $this->content .= "Content-Type: text/plain; charset=\"iso-8859-2\"\n"; $this->content .= "Content-Transfer-Encoding: 8bit\n\n"; } } function eMailAttachment($mimeType, $fileName, $data) { if ($this->type != 1) { $this->content .= "\n\n--___" . $this->marker . "==\n"; $this->content .= "Content-Type: " . $mimeType . "; name=\"" . $fileName . "\"\n"; $this->content .= "Content-Transfer-Encoding: base64\n"; $this->content .= "Content-Disposition: attachment; filename=\"" . $fileName . "\"\n\n"; $this->content .= chunk_split(base64_encode($data)); } } function eMailSend($to) { if ($this->type != 1) { $this->content .= "--___" . $this->marker . "==--\n\n"; // close marker } mail ($to, $this->subject, $this->content, $this->headers); } function eMailContent($subject, $content) { $this->subject = $subject; $this->content .= $content; } } $handle = fopen ("logo.jpg", "r"); $logo = fread($handle, filesize("logo.jpg")); fclose($handle); $tresc = 'Protokół wykonania usługi: Nr Zlecenia : '.$nrzlecenia.' Data : '.$data.' Ulica : '.$ulica.' Miejscowość : '.$miejscowosc.' Nr seryjny : '.$nrseryjny.' Typ : '.$typ.' WIADOMOŚĆ GENEROWANA AUTOMATYCZNIE - PROSIMY NA NIˇ NIE ODPOWIADAĆ System OnLine MalComm '; $wysylka = new eMail(2); // zwroc uwage na ustawienie typu 2 $wysylka->eMailContent('Protokół wykonania usługi - nr zlecenia '.$nrzlecenia.'', $tresc); //$wysylka->eMailAttachment('text/plain', 'mail.txt', 'Zawartość testowa'); $wysylka->eMailAttachment('image/gif', 'protokol.jpg', $logo); $wysylka->eMailSend('jakub.parlinski@malcomm.pl'); } ?>