Guest User

Untitled

a guest
Jun 23rd, 2018
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1. class eMail {
  2. var $to;
  3. var $subject;
  4. var $content;
  5. var $headers;
  6. var $marker;
  7. var $type;
  8. var $xMailer = "mailerek";
  9.  
  10. function eMail($type = "1", $from = "krawczyz ", $replyto = "krawczyz ")
  11. {
  12. $this->type = $type;
  13. $this->headers .= "From: " . $from . "\n";
  14. $this->headers .= "Reply-to: " . $replyto . "\n";
  15. $this->headers .= "X-Mailer: " . $this->xMailer . "\n";
  16. $this->headers .= "MIME-Version: 1.0\n";
  17. if ($type == 1) { // text/plain
  18. $this->headers .= "Content-Type: text/plain; charset=utf8\n";
  19. } else {
  20. srand((double)microtime() * 1000000);
  21. $this->marker = md5(uniqid(rand()));
  22. $this->headers .= "Content-Type: multipart/mixed;\n";
  23. $this->headers .= "\tboundary=\"___" . $this->marker . "==\"\n\n";
  24. $this->content = "--___" . $this->marker . "==\n";
  25. $this->content .= "Content-Type: text/plain; charset=\"utf8\"\n";
  26. $this->content .= "Content-Transfer-Encoding: 8bit\n\n";
  27. }
  28. }
  29.  
  30. function eMailAttachment($mimeType, $fileName, $data)
  31. {
  32. if ($this->type != 1) {
  33. $this->content .= "\n\n--___" . $this->marker . "==\n";
  34. $this->content .= "Content-Type: " . $mimeType . "; name=\"" . $fileName . "\"\n";
  35. $this->content .= "Content-Transfer-Encoding: base64\n";
  36. $this->content .= "Content-Disposition: attachment; filename=\"" . $fileName . "\"\n\n";
  37. $this->content .= chunk_split(base64_encode($data));
  38. }
  39. }
  40.  
  41. function eMailSend($to)
  42. {
  43. if($_POST[$to]!='noemik40i4@gmail.com' || $_POST[$to]!='ksiwek@iem.pw.edu.pl')
  44. {
  45. return false;
  46. }else
  47. {
  48. if ($this->type != 1) {
  49. $this->content .= "--___" . $this->marker . "==--\n\n"; // close marker
  50. }
  51. mail ($to, $this->subject, $this->content, $this->headers);
  52. }
  53. }
  54.  
  55. function eMailContent($subject, $content)
  56. {
  57. $this->subject = $subject;
  58. $this->content .= $content;
  59. }
  60. }
Add Comment
Please, Sign In to add comment