Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class eMail {
- var $to;
- var $subject;
- var $content;
- var $headers;
- var $marker;
- var $type;
- var $xMailer = "mailerek";
- function eMail($type = "1", $from = "krawczyz ", $replyto = "krawczyz ")
- {
- $this->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=utf8\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=\"utf8\"\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($_POST[$to]!='noemik40i4@gmail.com' || $_POST[$to]!='ksiwek@iem.pw.edu.pl')
- {
- return false;
- }else
- {
- 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;
- }
- }
Add Comment
Please, Sign In to add comment