PHP - RUTINA PHP PARA ENVIAR POR EJEMPLO 200 CORREOS SIMULTANEOS

 
Vista:

RUTINA PHP PARA ENVIAR POR EJEMPLO 200 CORREOS SIMULTANEOS

Publicado por Lina Barragan (1 intervención) el 03/02/2015 04:35:50
Un saludo a todos los presentes programadores:

Soy estudiante de ingeiería y he creado un servidor de correo pero necesito una rutina que me permita enviar por
ejemplo unos 500 correos simultaneos, es posible que me puedan ayudar?

Agradezco cualquier ayuda que me puedan brindar.

Quedo atenta, les deseo muchos éxitos.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
sin imagen de perfil
Val: 557
Bronce
Ha mantenido su posición en PHP (en relación al último mes)
Gráfica de PHP

RUTINA PHP PARA ENVIAR POR EJEMPLO 200 CORREOS SIMULTANEOS

Publicado por zendi (1056 intervenciones) el 04/02/2015 23:57:46
hola toma este codigo tambien funciona:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
$connect = pg_connect("host=localhost port=5432 dbname=tubase user=postgres password=******");
require("PHPMailer-master/class.phpmailer.php");
require("PHPMailer-master/class.smtp.php");
error_reporting(E_ALL ^ E_WARNING ^ E_NOTICE);
$de = $_POST["de_txt"];
$para = $_POST["para_txt"];
$asunto = $_POST["asunto_txt"];
$archivo = $_FILES["archivo_fls"]["tmp_name"];
$destino = $_SERVER['DOCUMENT_ROOT']."/".$_FILES["archivo_fls"]["name"];
//echo $_SERVER['DOCUMENT_ROOT'];
$mensaje = $_POST["mensaje_txa"];
if(move_uploaded_file($archivo,$destino))
{
	$smtp=new PHPMailer();
	# Indicamos que vamos a utilizar un servidor SMTP 
	$smtp->IsSMTP();
	# Definimos el formato del correo con UTF-8 
	$smtp->CharSet="UTF-8";
//	$smtp->SMTPDebug = 1; 
	# autenticación contra nuestro servidor smtp 
	$smtp->SMTPAuth = true; // enable SMTP authentication
	$smtp->SMTPSecure = "tls";
	$smtp->Host = "smtp.live.com";
	// sets MAIL as the SMTP server 
	$smtp->Username = "tucuentadecorreo@";
	// MAIL username
	$smtp->Password = "tupassword";
	// MAIL password 
	$smtp->Port = 587;
	# datos de quien realiza el envio 
	$smtp->From = "tucuentadecorreo@";
	// from mail 
	$smtp->FromName = "tunombre";
	// from mail name # Indicamos la dirección donde enviar el mensaje 
        $smtp->Subject = $asunto;
        $smtp->Body = $mensaje;
	$smtp->WordWrap = 50;
	$smtp->Timeout=30;
	$smtp->IsHTML(true);
	$smtp->MsgHTML("mensaje");
	$smtp->AddAttachment($destino, $_FILES["archivo_fls"]["name"]);
    $connect = pg_connect("host=localhost port=5432 dbname=tubase user=postgres password=******");
/*creo el array o query que debe traer tanto el nombre como la cuenta de correos*/
    $mailTo = "SELECT nombres,cta_correo FROM tuarchivo";
    $mailTo = @pg_query($connect,$mailTo);
while($select3 = @pg_fetch_array($mailTo))
{
      $name = $select3['nombres'];
	  $mail = $select3['cta_correo'];
      $smtp->ClearAllRecipients();
      $smtp->AddAddress($mail,$name);
 
   if (!$smtp->Send())
      {
         $respuesta ="El mensaje no se pudo enviar";
         $respuesta .="Error: " .$mail->ErrorInfo;
	  }
	  else
	  {
    	 $respuesta ="El mensaje ha sido enviado a todos los usuarios";
	  }
}
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <style>
  form { margin: 1em auto; text-align: center; }
   span{ color: #F60; font-size: 1.5 em; } 
   </style>
</head>
<body> <b>
<?php echo $respuesta;?>
</b>
<form name="mail_frm" method="post" enctype="multipart/form-data" action="<?php echo $_SERVER["PHP_SELF"]?>">
De:<input type="text" name="de_txt" /> <br/> <br/>
<!--Para:<input type="text" name="para_txt" /> <br/> <br/> 
-->Asunto:<input type="text" name="asunto_txt" /> <br/> <br/>
Adjuntar Archivo: <input type="file" name="archivo_fls" /> <br/> <br/>
Mensaje:<br /><textarea name= "mensaje_txa"/> </textarea> <br/> <br/>
  <input type="submit" name="enviar_btn" value="Enviar"/><br/>
  </form>
</body>
</html>

pero comentanos a ver que te pareció
el de Xavi es bueno tambien.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar