Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- *
- * @ This file is created by deZender.Net
- * @ deZender (PHP5 Decoder for ionCube Encoder)
- *
- * @ Version : 1.1.3.0
- * @ Author : DeZender
- * @ Release on : 17.05.2011
- * @ Official site : http://DeZender.Net
- *
- */
- class phpmailer {
- var $Priority = 3;
- var $CharSet = 'iso-8859-1';
- var $ContentType = 'text/plain';
- var $Encoding = '8bit';
- var $ErrorInfo = '';
- var $From = 'root@localhost';
- var $FromName = 'Root User';
- var $Sender = '';
- var $Subject = '';
- var $Body = '';
- var $AltBody = '';
- var $WordWrap = 0;
- var $Mailer = 'mail';
- var $Sendmail = '/usr/sbin/sendmail';
- var $PluginDir = '';
- var $Version = '1.73';
- var $ConfirmReadingTo = '';
- var $Hostname = '';
- var $Host = 'localhost';
- var $Port = 25;
- var $Helo = '';
- var $SMTPAuth = false;
- var $Username = '';
- var $Password = '';
- var $Timeout = 10;
- var $SMTPDebug = false;
- var $SMTPKeepAlive = false;
- var $smtp = NULL;
- var $to = array( );
- var $cc = array( );
- var $bcc = array( );
- var $ReplyTo = array( );
- var $attachment = array( );
- var $CustomHeader = array( );
- var $message_type = '';
- var $boundary = array( );
- var $language = array( );
- var $error_count = 0;
- var $LE = '
- ';
- function ishtml($bool) {
- if ($bool == true) {
- $this->ContentType = 'text/html';
- return null;
- }
- $this->ContentType = 'text/plain';
- }
- function issmtp() {
- $this->Mailer = 'smtp';
- }
- function ismail() {
- $this->Mailer = 'mail';
- }
- function issendmail() {
- $this->Mailer = 'sendmail';
- }
- function isqmail() {
- $this->Sendmail = '/var/qmail/bin/sendmail';
- $this->Mailer = 'sendmail';
- }
- function addaddress($address, $name = '') {
- $cur = count( $this->to );
- $this->to[$cur][0] = trim( $address );
- $this->to[$cur][1] = $name;
- }
- function addcc($address, $name = '') {
- $cur = count( $this->cc );
- $this->cc[$cur][0] = trim( $address );
- $this->cc[$cur][1] = $name;
- }
- function addbcc($address, $name = '') {
- $cur = count( $this->bcc );
- $this->bcc[$cur][0] = trim( $address );
- $this->bcc[$cur][1] = $name;
- }
- function addreplyto($address, $name = '') {
- $cur = count( $this->ReplyTo );
- $this->ReplyTo[$cur][0] = trim( $address );
- $this->ReplyTo[$cur][1] = $name;
- }
- function send() {
- $header = '';
- $body = '';
- $result = true;
- if (count( $this->to ) + count( $this->cc ) + count( $this->bcc ) < 1) {
- $this->SetError( $this->Lang( 'provide_address' ) );
- return false;
- }
- if (!empty( $this->AltBody )) {
- $this->ContentType = 'multipart/alternative';
- }
- $this->error_count = 0;
- $this->SetMessageType( );
- $header .= $this->CreateHeader( );
- $body = $this->CreateBody( );
- if ($body == '') {
- return false;
- }
- switch ($this->Mailer) {
- case 'sendmail': {
- $result = $this->SendmailSend( $header, $body );
- break;
- }
- case 'mail': {
- $result = $this->MailSend( $header, $body );
- break;
- }
- case 'smtp': {
- $result = $this->SmtpSend( $header, $body );
- break;
- }
- default: {
- $this->SetError( $this->Mailer . $this->Lang( 'mailer_not_supported' ) );
- $result = false;
- break;
- }
- }
- return $result;
- }
- function sendmailsend($header, $body) {
- if ($this->Sender != '') {
- $sendmail = sprintf( '%s -oi -f %s -t', $this->Sendmail, $this->Sender );
- } else {
- $sendmail = sprintf( '%s -oi -t', $this->Sendmail );
- }
- if (!$mail = @popen( $sendmail, 'w' )) {
- $this->SetError( $this->Lang( 'execute' ) . $this->Sendmail );
- return false;
- }
- fputs( $mail, $header );
- fputs( $mail, $body );
- $result = pclose( $mail ) >> 8 & 255;
- if ($result != 0) {
- $this->SetError( $this->Lang( 'execute' ) . $this->Sendmail );
- return false;
- }
- return true;
- }
- function mailsend($header, $body) {
- $to = '';
- $i = 0;
- while ($i < count( $this->to )) {
- if ($i != 0) {
- $to .= ', ';
- }
- $to .= $this->to[$i][0];
- ++$i;
- }
- if (( $this->Sender != '' && strlen( ini_get( 'safe_mode' ) ) < 1 )) {
- $old_from = ini_get( 'sendmail_from' );
- ini_set( 'sendmail_from', $this->Sender );
- $params = sprintf( '-oi -f %s', $this->Sender );
- $rt = @mail( $to, @$this->EncodeHeader( $this->Subject ), $body, $header, $params );
- } else {
- $rt = @mail( $to, @$this->EncodeHeader( $this->Subject ), $body, $header );
- }
- if (isset( $old_from )) {
- ini_set( 'sendmail_from', $old_from );
- }
- if (!$rt) {
- $this->SetError( $this->Lang( 'instantiate' ) );
- return false;
- }
- return true;
- }
- function smtpsend($header, $body) {
- include_once( $this->PluginDir . 'class.smtp.php' );
- $error = '';
- $bad_rcpt = array( );
- if (!$this->SmtpConnect( )) {
- return false;
- }
- $smtp_from = ($this->Sender == '' ? $this->From : $this->Sender);
- if (!$this->smtp->Mail( $smtp_from )) {
- $error = $this->Lang( 'from_failed' ) . $smtp_from;
- $this->SetError( $error );
- $this->smtp->Reset( );
- return false;
- }
- $i = 0;
- while ($i < count( $this->to )) {
- if (!$this->smtp->Recipient( $this->to[$i][0] )) {
- $bad_rcpt[] = $this->to[$i][0];
- }
- ++$i;
- }
- $i = 0;
- while ($i < count( $this->cc )) {
- if (!$this->smtp->Recipient( $this->cc[$i][0] )) {
- $bad_rcpt[] = $this->cc[$i][0];
- }
- ++$i;
- }
- $i = 0;
- while ($i < count( $this->bcc )) {
- if (!$this->smtp->Recipient( $this->bcc[$i][0] )) {
- $bad_rcpt[] = $this->bcc[$i][0];
- }
- ++$i;
- }
- if (0 < count( $bad_rcpt )) {
- $i = 0;
- while ($i < count( $bad_rcpt )) {
- if ($i != 0) {
- $error .= ', ';
- }
- $error .= $bad_rcpt[$i];
- ++$i;
- }
- $error = $this->Lang( 'recipients_failed' ) . $error;
- $this->SetError( $error );
- $this->smtp->Reset( );
- return false;
- }
- if (!$this->smtp->Data( $header . $body )) {
- $this->SetError( $this->Lang( 'data_not_accepted' ) );
- $this->smtp->Reset( );
- return false;
- }
- if ($this->SMTPKeepAlive == true) {
- $this->smtp->Reset( );
- } else {
- $this->SmtpClose( );
- }
- return true;
- }
- function smtpconnect() {
- if ($this->smtp == NULL) {
- $this->smtp = new SMTP( );
- }
- $this->smtp->do_debug = $this->SMTPDebug;
- $hosts = explode( ';', $this->Host );
- $index = 0;
- $connection = $this->smtp->Connected( );
- while (( $index < count( $hosts ) && $connection == false )) {
- if (strstr( $hosts[$index], ':' )) {
- list( $host, $port ) = explode( ':', $hosts[$index] );
- } else {
- $host = $hosts[$index];
- $port = $this->Port;
- }
- if ($this->smtp->Connect( $host, $port, $this->Timeout )) {
- if ($this->Helo != '') {
- $this->smtp->Hello( $this->Helo );
- } else {
- $this->smtp->Hello( $this->ServerHostname( ) );
- }
- if ($this->SMTPAuth) {
- if (!$this->smtp->Authenticate( $this->Username, $this->Password )) {
- $this->SetError( $this->Lang( 'authenticate' ) );
- $this->smtp->Reset( );
- $connection = false;
- }
- }
- $connection = true;
- }
- ++$index;
- }
- if (!$connection) {
- $this->SetError( $this->Lang( 'connect_host' ) );
- }
- return $connection;
- }
- function smtpclose() {
- if ($this->smtp != NULL) {
- if ($this->smtp->Connected( )) {
- $this->smtp->Quit( );
- $this->smtp->Close( );
- }
- }
- }
- function setlanguage($lang_type, $lang_path = 'language/') {
- if (file_exists( $lang_path . 'phpmailer.lang-' . $lang_type . '.php' )) {
- include( $lang_path . 'phpmailer.lang-' . $lang_type . '.php' );
- } else {
- if (file_exists( $lang_path . 'phpmailer.lang-en.php' )) {
- include( $lang_path . 'phpmailer.lang-en.php' );
- } else {
- $this->SetError( 'Could not load language file' );
- return false;
- }
- }
- $this->language = $PHPMAILER_LANG;
- return true;
- }
- function addrappend($type, $addr) {
- $addr_str = $type . ': ';
- $addr_str .= $this->AddrFormat( $addr[0] );
- if (1 < count( $addr )) {
- $i = 1;
- while ($i < count( $addr )) {
- $addr_str .= ', ' . $this->AddrFormat( $addr[$i] );
- ++$i;
- }
- }
- $addr_str .= $this->LE;
- return $addr_str;
- }
- function addrformat($addr) {
- if (empty( $addr[1] )) {
- $formatted = $addr[0];
- } else {
- $formatted = $this->EncodeHeader( $addr[1], 'phrase' ) . ' <' . $addr[0] . '>';
- }
- return $formatted;
- }
- .....................................
- ......................
- ...........
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement