Advertisement
Guest User

Untitled

a guest
May 2nd, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.32 KB | None | 0 0
  1. <?php if(!isset($_SESSION['admin'])){echo 'Hacking attempted'; return ;}
  2. // number of mail sent by batch
  3. $sendatatime=1;
  4. if($_GET['email_from']>=$sendatatime){
  5.     include("admin/head.php");
  6. }
  7. // the settings are stored here //
  8. require("admin/class/phpmailer/class.phpmailer.php");
  9. include("temp/email.php");
  10.  
  11. $subject=stripslashes($subject);
  12. $messagetext=stripslashes($messagetext);
  13. $messagehtml=stripslashes($messagehtml);
  14.  
  15.  
  16. if(!isset($email_from))
  17.     {
  18.     $email_from=0;
  19.     }
  20.  
  21.  
  22. $mail = new phpmailer();
  23.  
  24. $mail->Subject  = $subject;
  25. $mail->From     = $email_email;
  26. $mail->FromName = $email_name;
  27. $mail->ContentType = "text/plain";
  28. switch($mserver)
  29. {
  30. case "smtp" :
  31.             $mail->Host=$smtp_string;
  32.             //echo $mail->Host;
  33.             $mail->SMTPDebug=false;
  34.             if($smtp_auth=="yes")
  35.             {
  36.             $mail->SMTPAuth=true;
  37.             $mail->Username=$smtp_username;
  38.             $mail->Password=$smtp_password;
  39.             }
  40.             $mail->Mailer="smtp";
  41.              break;
  42. case "sendmail"  :
  43.             $mail->Sendmail=$sendmail_string;
  44.             $mail->Mailer="sendmail";
  45.             break;
  46. case "php":
  47. default :
  48.             $mail->Mailer="mail";
  49.             break;
  50.  
  51. }
  52. if(is_file($attach)) {$mail->AddAttachment($attach); }
  53. $unsub_html="";
  54. $unsub_text="";
  55. if($email_unsubscribe=="yes")
  56.     {
  57.     $unsub_html=str_replace("{ulink}",'.$website.$relative_string."subscribe=false&email={email}"',$email_unsubscribe_message);
  58.     //$unsub_html=str_replace("{/ulink}","</a>",$unsub_html);
  59.     $unsub_text="\n\n".'Please follow this link to Unsubscribe : '.$website.$relative_string.'subscribe=false&email={email}';
  60.     }
  61. /////////////////////////////////////////////////////////////////////
  62. //                       Fill in the content
  63. /////////////////////////////////////////////////////////////////////
  64. if(strlen($messagetext)>0)
  65. {
  66. if(strlen($messagehtml) == 0 ) $mail->Body = $messagetext.$unsub_text;
  67.  else $mail->AltBody = $messagetext.$unsub_text;
  68. }
  69.  
  70. $mail_type="";
  71. $tmail = new phpmailer();
  72. //$sendatatime was 50
  73. for($i=$email_from;$i<$email_from+$sendatatime;$i++)
  74. {
  75. $tmail=$mail;
  76. if($i==$total_entries){$send_all="true"; break;}
  77.  
  78. $tmail->Body=str_replace("{email}",$category_list[$i]["email"],$tmail->Body);
  79. $tmail->AltBody=str_replace("{email}",$category_list[$i]["email"],$tmail->AltBody);
  80.  
  81. $tmail->AddAddress($category_list[$i]["email"]);
  82. // send the email //////////////////////////////////
  83. if(!$tmail->Send())echo "Error sending to : ".$category_list[$i]["email"];
  84. // me testing echo "<pre>".print_r($tmail)."</pre>";
  85. $tmail->ClearAddresses();
  86. }
  87. //$sendatatime was 50
  88. $email_from+=$sendatatime;
  89. // create archive
  90. if(isset($_POST['archive-it'])){
  91. //if(isset($send_all)) {
  92.     createArchive($subject,$messagetext,$attach);
  93. }
  94. // delete the temporary file
  95. if(isset($send_all) && is_file($attach) ) unlink($attach);
  96.  
  97. ?>
  98. <div class="sending">
  99. <img src="admin/images/email_icon.gif" width="16" height="16" alt="" />
  100. <?php
  101. echo $lang_send_mails;
  102. echo $lang_send_sending;
  103. // test send more than 50
  104. if(!isset($send_all)){
  105.     echo "<p>Send next batch <a href=\"admin.php?action=send&email_from=".$email_from."\">now</a>";
  106. }
  107. if(!isset($send_all))
  108. {
  109. echo $lang_send_close;
  110. }
  111. if(isset($send_all))
  112. {
  113. echo $lang_send_done;
  114. echo "<p><a href=\"".$_SERVER['PHP_SELF']."\">Return to the newsletter page</a></p>";
  115. }
  116. ?>
  117. </div>
  118. <?php
  119. if($_GET['email_from']>=$sendatatime){
  120.     include("admin/tail.php");
  121. }
  122. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement