Advertisement
Guest User

Untitled

a guest
Sep 26th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. <?php
  2.  
  3. function SMTPClient ($SmtpServer, $SmtpPort, $SmtpUser, $SmtpPass, $from, $to, $subject, $body)
  4. {
  5.  
  6. $this->SmtpServer = $SmtpServer;
  7. $this->SmtpUser = base64_encode ($SmtpUser);
  8. $this->SmtpPass = base64_encode ($SmtpPass);
  9. $this->from = $from;
  10. $this->to = $to;
  11. $this->subject = $subject;
  12. $this->body = $body;
  13.  
  14. if ($SmtpPort == "")
  15. {
  16. $this->PortSMTP = 25;
  17. }
  18. else
  19. {
  20. $this->PortSMTP = $SmtpPort;
  21. }
  22. }
  23.  
  24. function SendMail ()
  25. {
  26. if ($SMTPIN = fsockopen ($this->SmtpServer, $this->PortSMTP))
  27. {
  28. fputs ($SMTPIN, "EHLO ".$HTTP_HOST."rn");
  29. $talk["hello"] = fgets ( $SMTPIN, 1024 );
  30. fputs($SMTPIN, "auth loginrn");
  31. $talk["res"]=fgets($SMTPIN,1024);
  32. fputs($SMTPIN, $this->SmtpUser."rn");
  33. $talk["user"]=fgets($SMTPIN,1024);
  34. fputs($SMTPIN, $this->SmtpPass."rn");
  35. $talk["pass"]=fgets($SMTPIN,256);
  36. fputs ($SMTPIN, "MAIL FROM: <".$this->from.">rn");
  37. $talk["From"] = fgets ( $SMTPIN, 1024 );
  38. fputs ($SMTPIN, "RCPT TO: <".$this->to.">rn");
  39. $talk["To"] = fgets ($SMTPIN, 1024);
  40. fputs($SMTPIN, "DATArn");
  41. $talk["data"]=fgets( $SMTPIN,1024 );
  42. fputs($SMTPIN, "To: <".$this->to.">rnFrom: <".$this->from.">rnSubject:".$this->subject."rnrnrn".$this->body."rn.rn");
  43.  
  44. $talk["send"]=fgets($SMTPIN,256);
  45.  
  46. fputs ($SMTPIN, "QUITrn");
  47. fclose($SMTPIN);
  48. }
  49. return $talk;
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement