Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2018
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. <?php
  2.  
  3. class SMTPClient
  4. {
  5.  
  6. function SMTPClient ($SmtpServer, $SmtpPort, $SmtpUser, $SmtpPass, $from, $to, $subject, $body)
  7. {
  8.  
  9. $this->SmtpServer = $SmtpServer;
  10. $this->SmtpUser = base64_encode ($SmtpUser);
  11. $this->SmtpPass = base64_encode ($SmtpPass);
  12. $this->from = $from;
  13. $this->to = $to;
  14.  
  15. $this->subject = $subject;
  16. $this->body = $body;
  17.  
  18. if ($SmtpPort == "")
  19. {
  20. $this->PortSMTP = 25;
  21. }else{
  22. $this->PortSMTP = $SmtpPort;
  23. }
  24. }
  25.  
  26. function SendMail ()
  27. {
  28.  
  29. if ($SMTPIN = fsockopen ($this->SmtpServer, $this->PortSMTP))
  30. {
  31.  
  32. fputs ($SMTPIN, "EHLO ".$HTTP_HOST."\r\n");
  33. $talk["hello"] = fgets ( $SMTPIN, 1024 );
  34.  
  35. fputs($SMTPIN, "auth login\r\n");
  36. $talk["res"]=fgets($SMTPIN,1024);
  37. fputs($SMTPIN, $this->SmtpUser."\r\n");
  38. $talk["user"]=fgets($SMTPIN,1024);
  39.  
  40. fputs($SMTPIN, $this->SmtpPass."\r\n");
  41. $talk["pass"]=fgets($SMTPIN,256);
  42.  
  43. fputs ($SMTPIN, "MAIL FROM: <".$this->from.">\r\n");
  44. $talk["From"] = fgets ( $SMTPIN, 1024 );
  45. fputs ($SMTPIN, "RCPT TO: <".$this->to.">\r\n");
  46. $talk["To"] = fgets ($SMTPIN, 1024);
  47.  
  48. fputs($SMTPIN, "DATA\r\n");
  49. $talk["data"]=fgets( $SMTPIN,1024 );
  50.  
  51. fputs($SMTPIN, "To: <".$this->to.">\r\nFrom: <".$this->from.">\r\nSubject:".$this->subject."\r\n\r\n\r\n".$this->body."\r\n.\r\n");
  52. $talk["send"]=fgets($SMTPIN,256);
  53.  
  54. //CLOSE CONNECTION AND EXIT ...
  55.  
  56. fputs ($SMTPIN, "QUIT\r\n");
  57. fclose($SMTPIN);
  58. //
  59. }
  60.  
  61. return $talk;
  62. }
  63. }
  64. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement