Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Aviso ! Isto não foi uma invasão, apenas peguei um arquivo já disponível dentro do sistema !
- SMTP Connection found on abem-educmed
- Site: http://www.abem-educmed.org.br/
- Using FTP connection [FTPUSE] where ftpuse X: ftp.abem-educmed.org.br uses : netrix.abem-educmed.org.br for server FTP
- Arquivo: smtp.class {Tem o arquivo disponibilizado no site em /pcchair/smtp.class }
- class SMTP {
- var $smtp_sock = "";
- var $theServer = "";
- var $thePort = 25;
- var $theError = "";
- var $theFrom = "";
- var $theTo = "";
- var $theSubject = "";
- var $theBody = "";
- var $theAttachment = Array();
- var $nbAttachments = 0;
- function SMTP($server) {
- $this->theServer = $server;
- }
- function connect() { // Used internally
- if ($this->theServer != "") {
- while ((!$this->smtp_sock = fsockopen($this->theServer, $this->thePort, &$errno, &$errstr, 30)) && ($tries<50)) {
- debug ("Couldn't open mail connection to ".$this->theServer."! ($errno, $errstr, try $tries)");
- $tries++;
- $this->wait(5);
- }
- $reply=$this->get_lines();
- return TRUE;
- } else {
- debug ("No server defined!");
- $this->theError = "No server defined!";
- return FALSE;
- }
- }
- function hello() { // Used internally
- if ($this->smtp_sock != "") {
- fputs($this->smtp_sock, "HELO ".$this->theServer."\n");
- $reply=$this->get_lines();
- } else {
- debug ("Not connected!");
- $this->theError = "Not connected!";
- return FALSE;
- }
- }
- function from($from) {
- $this->theFrom = $from;
- }
- function to($to) {
- $this->theTo = $to;
- }
- function subject($subject) {
- $this->theSubject = $subject;
- }
- function body($body) {
- $this->theBody = $body;
- }
- function attachment($attachment, $attachment_name) {
- if (($attachment != "") && ($attachment_name != "")) {
- $this->theAttachment[$this->nbAttachments]["file"] = $attachment;
- $this->theAttachment[$this->nbAttachments]["file_name"] = $attachment_name;
- $this->nbAttachments++;
- }
- }
- function send() {
- if ($this->connect()) {
- $this->hello();
- fputs($this->smtp_sock, "MAIL FROM: ".$this->theFrom."\n");
- $reply=$this->get_lines();
- fputs($this->smtp_sock, "RCPT TO: ".$this->theTo."\n");
- $reply=$this->get_lines();
- fputs($this->smtp_sock, "DATA\n");
- $reply=$this->get_lines();
- fputs($this->smtp_sock, "From: ".$this->theFrom."\n");
- fputs($this->smtp_sock, "To: ".$this->theTo."\n");
- fputs($this->smtp_sock, "Subject: ".$this->theSubject."\n");
- if ($this->nbAttachments >0) {
- $boundary = "--------" . uniqid( "part" );
- $headers .= "MIME-Version: 1.0";
- $headers .= "\nContent-Type: multipart/mixed; boundary=\"$boundary\"";
- $messagetmp = "This is a multi-part message in MIME format.\n\n";
- $messagetmp .= "--$boundary\n";
- $messagetmp .= "Content-Type: text/plain; charset=us-ascii\n";
- $messagetmp .= "Content-Transfer-Encoding: 7bit\n\n";
- $messagetmp .= $this->theBody . "\n\n";
- for($i=0; $i<$this->nbAttachments; $i++) {
- $file = $this->theAttachment[$i]["file"];
- $file_name = $this->theAttachment[$i]["file_name"];
- $file_type = "application/octet-stream";
- $messagetmp .= "--$boundary\n";
- $messagetmp .= "Content-Type: " . $file_type . "; name=\"$file_name\"\n";
- $messagetmp .= "Content-Transfer-Encoding: base64\n\n";
- $messagetmp .= chunk_split( base64_encode($file) );
- $messagetmp .= "\n";
- $messagetmp .= "\n\n";
- }
- $this->theBody = $headers."\n".$messagetmp;
- }
- fputs($this->smtp_sock, $this->theBody."\n");
- fputs($this->smtp_sock, "\n.\nQUIT\n");
- $reply=$this->get_lines();
- return TRUE;
- }
- }
- function wait($t) {
- $start = time();
- $end = $start;
- while ($end < ($start+$t)) {
- $end = time();
- }
- }
- function get_lines() {
- $data = "";
- while($str = fgets($this->smtp_sock,515)) {
- $data .= $str;
- if(substr($str,3,1) == " ") { break; }
- }
- return $data;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement