Advertisement
Guest User

Untitled

a guest
Nov 13th, 2011
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.74 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @ This file is created by deZender.Net
  5. * @ deZender (PHP5 Decoder for ionCube Encoder)
  6. *
  7. * @ Version : 1.1.3.0
  8. * @ Author : DeZender
  9. * @ Release on : 17.05.2011
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. class phpmailer {
  15. var $Priority = 3;
  16. var $CharSet = 'iso-8859-1';
  17. var $ContentType = 'text/plain';
  18. var $Encoding = '8bit';
  19. var $ErrorInfo = '';
  20. var $From = 'root@localhost';
  21. var $FromName = 'Root User';
  22. var $Sender = '';
  23. var $Subject = '';
  24. var $Body = '';
  25. var $AltBody = '';
  26. var $WordWrap = 0;
  27. var $Mailer = 'mail';
  28. var $Sendmail = '/usr/sbin/sendmail';
  29. var $PluginDir = '';
  30. var $Version = '1.73';
  31. var $ConfirmReadingTo = '';
  32. var $Hostname = '';
  33. var $Host = 'localhost';
  34. var $Port = 25;
  35. var $Helo = '';
  36. var $SMTPAuth = false;
  37. var $Username = '';
  38. var $Password = '';
  39. var $Timeout = 10;
  40. var $SMTPDebug = false;
  41. var $SMTPKeepAlive = false;
  42. var $smtp = NULL;
  43. var $to = array( );
  44. var $cc = array( );
  45. var $bcc = array( );
  46. var $ReplyTo = array( );
  47. var $attachment = array( );
  48. var $CustomHeader = array( );
  49. var $message_type = '';
  50. var $boundary = array( );
  51. var $language = array( );
  52. var $error_count = 0;
  53. var $LE = '
  54. ';
  55.  
  56. function ishtml($bool) {
  57. if ($bool == true) {
  58. $this->ContentType = 'text/html';
  59. return null;
  60. }
  61.  
  62. $this->ContentType = 'text/plain';
  63. }
  64.  
  65. function issmtp() {
  66. $this->Mailer = 'smtp';
  67. }
  68.  
  69. function ismail() {
  70. $this->Mailer = 'mail';
  71. }
  72.  
  73. function issendmail() {
  74. $this->Mailer = 'sendmail';
  75. }
  76.  
  77. function isqmail() {
  78. $this->Sendmail = '/var/qmail/bin/sendmail';
  79. $this->Mailer = 'sendmail';
  80. }
  81.  
  82. function addaddress($address, $name = '') {
  83. $cur = count( $this->to );
  84. $this->to[$cur][0] = trim( $address );
  85. $this->to[$cur][1] = $name;
  86. }
  87.  
  88. function addcc($address, $name = '') {
  89. $cur = count( $this->cc );
  90. $this->cc[$cur][0] = trim( $address );
  91. $this->cc[$cur][1] = $name;
  92. }
  93.  
  94. function addbcc($address, $name = '') {
  95. $cur = count( $this->bcc );
  96. $this->bcc[$cur][0] = trim( $address );
  97. $this->bcc[$cur][1] = $name;
  98. }
  99.  
  100. function addreplyto($address, $name = '') {
  101. $cur = count( $this->ReplyTo );
  102. $this->ReplyTo[$cur][0] = trim( $address );
  103. $this->ReplyTo[$cur][1] = $name;
  104. }
  105.  
  106. function send() {
  107. $header = '';
  108. $body = '';
  109. $result = true;
  110.  
  111. if (count( $this->to ) + count( $this->cc ) + count( $this->bcc ) < 1) {
  112. $this->SetError( $this->Lang( 'provide_address' ) );
  113. return false;
  114. }
  115.  
  116. if (!empty( $this->AltBody )) {
  117. $this->ContentType = 'multipart/alternative';
  118. }
  119.  
  120. $this->error_count = 0;
  121. $this->SetMessageType( );
  122. $header .= $this->CreateHeader( );
  123. $body = $this->CreateBody( );
  124.  
  125. if ($body == '') {
  126. return false;
  127. }
  128.  
  129. switch ($this->Mailer) {
  130. case 'sendmail': {
  131. $result = $this->SendmailSend( $header, $body );
  132. break;
  133. }
  134.  
  135. case 'mail': {
  136. $result = $this->MailSend( $header, $body );
  137. break;
  138. }
  139.  
  140. case 'smtp': {
  141. $result = $this->SmtpSend( $header, $body );
  142. break;
  143. }
  144.  
  145. default: {
  146. $this->SetError( $this->Mailer . $this->Lang( 'mailer_not_supported' ) );
  147. $result = false;
  148. break;
  149. }
  150. }
  151.  
  152. return $result;
  153. }
  154.  
  155. function sendmailsend($header, $body) {
  156. if ($this->Sender != '') {
  157. $sendmail = sprintf( '%s -oi -f %s -t', $this->Sendmail, $this->Sender );
  158. } else {
  159. $sendmail = sprintf( '%s -oi -t', $this->Sendmail );
  160. }
  161.  
  162.  
  163. if (!$mail = @popen( $sendmail, 'w' )) {
  164. $this->SetError( $this->Lang( 'execute' ) . $this->Sendmail );
  165. return false;
  166. }
  167.  
  168. fputs( $mail, $header );
  169. fputs( $mail, $body );
  170. $result = pclose( $mail ) >> 8 & 255;
  171.  
  172. if ($result != 0) {
  173. $this->SetError( $this->Lang( 'execute' ) . $this->Sendmail );
  174. return false;
  175. }
  176.  
  177. return true;
  178. }
  179.  
  180. function mailsend($header, $body) {
  181. $to = '';
  182. $i = 0;
  183.  
  184. while ($i < count( $this->to )) {
  185. if ($i != 0) {
  186. $to .= ', ';
  187. }
  188.  
  189. $to .= $this->to[$i][0];
  190. ++$i;
  191. }
  192.  
  193.  
  194. if (( $this->Sender != '' && strlen( ini_get( 'safe_mode' ) ) < 1 )) {
  195. $old_from = ini_get( 'sendmail_from' );
  196. ini_set( 'sendmail_from', $this->Sender );
  197. $params = sprintf( '-oi -f %s', $this->Sender );
  198. $rt = @mail( $to, @$this->EncodeHeader( $this->Subject ), $body, $header, $params );
  199. } else {
  200. $rt = @mail( $to, @$this->EncodeHeader( $this->Subject ), $body, $header );
  201. }
  202.  
  203.  
  204. if (isset( $old_from )) {
  205. ini_set( 'sendmail_from', $old_from );
  206. }
  207.  
  208. if (!$rt) {
  209. $this->SetError( $this->Lang( 'instantiate' ) );
  210. return false;
  211. }
  212.  
  213. return true;
  214. }
  215.  
  216. function smtpsend($header, $body) {
  217. include_once( $this->PluginDir . 'class.smtp.php' );
  218. $error = '';
  219. $bad_rcpt = array( );
  220.  
  221. if (!$this->SmtpConnect( )) {
  222. return false;
  223. }
  224.  
  225. $smtp_from = ($this->Sender == '' ? $this->From : $this->Sender);
  226.  
  227. if (!$this->smtp->Mail( $smtp_from )) {
  228. $error = $this->Lang( 'from_failed' ) . $smtp_from;
  229. $this->SetError( $error );
  230. $this->smtp->Reset( );
  231. return false;
  232. }
  233.  
  234. $i = 0;
  235.  
  236. while ($i < count( $this->to )) {
  237. if (!$this->smtp->Recipient( $this->to[$i][0] )) {
  238. $bad_rcpt[] = $this->to[$i][0];
  239. }
  240.  
  241. ++$i;
  242. }
  243.  
  244. $i = 0;
  245.  
  246. while ($i < count( $this->cc )) {
  247. if (!$this->smtp->Recipient( $this->cc[$i][0] )) {
  248. $bad_rcpt[] = $this->cc[$i][0];
  249. }
  250.  
  251. ++$i;
  252. }
  253.  
  254. $i = 0;
  255.  
  256. while ($i < count( $this->bcc )) {
  257. if (!$this->smtp->Recipient( $this->bcc[$i][0] )) {
  258. $bad_rcpt[] = $this->bcc[$i][0];
  259. }
  260.  
  261. ++$i;
  262. }
  263.  
  264.  
  265. if (0 < count( $bad_rcpt )) {
  266. $i = 0;
  267.  
  268. while ($i < count( $bad_rcpt )) {
  269. if ($i != 0) {
  270. $error .= ', ';
  271. }
  272.  
  273. $error .= $bad_rcpt[$i];
  274. ++$i;
  275. }
  276.  
  277. $error = $this->Lang( 'recipients_failed' ) . $error;
  278. $this->SetError( $error );
  279. $this->smtp->Reset( );
  280. return false;
  281. }
  282.  
  283. if (!$this->smtp->Data( $header . $body )) {
  284. $this->SetError( $this->Lang( 'data_not_accepted' ) );
  285. $this->smtp->Reset( );
  286. return false;
  287. }
  288.  
  289. if ($this->SMTPKeepAlive == true) {
  290. $this->smtp->Reset( );
  291. } else {
  292. $this->SmtpClose( );
  293. }
  294.  
  295. return true;
  296. }
  297.  
  298. function smtpconnect() {
  299. if ($this->smtp == NULL) {
  300. $this->smtp = new SMTP( );
  301. }
  302.  
  303. $this->smtp->do_debug = $this->SMTPDebug;
  304. $hosts = explode( ';', $this->Host );
  305. $index = 0;
  306. $connection = $this->smtp->Connected( );
  307.  
  308. while (( $index < count( $hosts ) && $connection == false )) {
  309. if (strstr( $hosts[$index], ':' )) {
  310. list( $host, $port ) = explode( ':', $hosts[$index] );
  311. } else {
  312. $host = $hosts[$index];
  313. $port = $this->Port;
  314. }
  315.  
  316.  
  317. if ($this->smtp->Connect( $host, $port, $this->Timeout )) {
  318. if ($this->Helo != '') {
  319. $this->smtp->Hello( $this->Helo );
  320. } else {
  321. $this->smtp->Hello( $this->ServerHostname( ) );
  322. }
  323.  
  324.  
  325. if ($this->SMTPAuth) {
  326. if (!$this->smtp->Authenticate( $this->Username, $this->Password )) {
  327. $this->SetError( $this->Lang( 'authenticate' ) );
  328. $this->smtp->Reset( );
  329. $connection = false;
  330. }
  331. }
  332.  
  333. $connection = true;
  334. }
  335.  
  336. ++$index;
  337. }
  338.  
  339.  
  340. if (!$connection) {
  341. $this->SetError( $this->Lang( 'connect_host' ) );
  342. }
  343.  
  344. return $connection;
  345. }
  346.  
  347. function smtpclose() {
  348. if ($this->smtp != NULL) {
  349. if ($this->smtp->Connected( )) {
  350. $this->smtp->Quit( );
  351. $this->smtp->Close( );
  352. }
  353. }
  354.  
  355. }
  356.  
  357. function setlanguage($lang_type, $lang_path = 'language/') {
  358. if (file_exists( $lang_path . 'phpmailer.lang-' . $lang_type . '.php' )) {
  359. include( $lang_path . 'phpmailer.lang-' . $lang_type . '.php' );
  360. } else {
  361. if (file_exists( $lang_path . 'phpmailer.lang-en.php' )) {
  362. include( $lang_path . 'phpmailer.lang-en.php' );
  363. } else {
  364. $this->SetError( 'Could not load language file' );
  365. return false;
  366. }
  367. }
  368.  
  369. $this->language = $PHPMAILER_LANG;
  370. return true;
  371. }
  372.  
  373. function addrappend($type, $addr) {
  374. $addr_str = $type . ': ';
  375. $addr_str .= $this->AddrFormat( $addr[0] );
  376.  
  377. if (1 < count( $addr )) {
  378. $i = 1;
  379.  
  380. while ($i < count( $addr )) {
  381. $addr_str .= ', ' . $this->AddrFormat( $addr[$i] );
  382. ++$i;
  383. }
  384. }
  385.  
  386. $addr_str .= $this->LE;
  387. return $addr_str;
  388. }
  389.  
  390. function addrformat($addr) {
  391. if (empty( $addr[1] )) {
  392. $formatted = $addr[0];
  393. } else {
  394. $formatted = $this->EncodeHeader( $addr[1], 'phrase' ) . ' <' . $addr[0] . '>';
  395. }
  396.  
  397. return $formatted;
  398. }
  399. .....................................
  400. ......................
  401. ...........
  402.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement