Foros del Web » Programando para Internet » PHP »

ayuda phpmailer

Estas en el tema de ayuda phpmailer en el foro de PHP en Foros del Web. Hola a todos, Os explico, tengo el siguiente codigo: <?php $texto = $_POST['texto']; $edu = $_POST['edu']; if ($_POST['asignatura']=="") { $asunto="[RICHMOND] ".$_POST["asunto"]; } else { $asunto="[RICHMOND]".$_POST["asignatura"]." ...
  #1 (permalink)  
Antiguo 23/11/2009, 12:33
 
Fecha de Ingreso: mayo-2009
Mensajes: 43
Antigüedad: 14 años, 11 meses
Puntos: 2
ayuda phpmailer

Hola a todos,

Os explico, tengo el siguiente codigo:

<?php
$texto = $_POST['texto'];
$edu = $_POST['edu'];
if ($_POST['asignatura']=="") {
$asunto="[RICHMOND] ".$_POST["asunto"];
}
else {
$asunto="[RICHMOND]".$_POST["asignatura"]." - ".$_POST["asunto"];
}
$sender = $_POST['sender'];
$informacion = $_POST['informacion'];
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Host = "*****"; // sets GMAIL as the SMTP server
$mail->Port = 465; // set the SMTP port for the GMAIL server
$mail->IsHTML(true);
$mail->Username = "*****"; // GMAIL username
$mail->Password = "****"; // GMAIL password
$mail->From = $_POST['sender'];
$mail->FromName = $_POST['nombre'];
$mail->Sender = $_POST['sender'];
$mail->Subject = $asunto;
$mail->Body = "<table border='0' cellpadding='0' bordercolor='black' style='border-collapse: collapse'>
<tr>
<td height='51' width='16' bgcolor='black' style='border-left-style: solid; border-left-width: 1px; border-right-style: none; border-right-width: medium; border-top-style: solid; border-top-width: 1px; border-bottom-style: solid; border-bottom-width: 1px' rowspan='2'>&nbsp;</td>
<td bgcolor='red' style='border-left-style: none; border-left-width: medium; border-right-style: solid; border-right-width: 1px; border-top-style: solid; border-top-width: 1px; border-bottom-style: solid; border-bottom-width: 1px'>
<p align='center'><b><span style='background-color: 'red'>
<font size='2' color='black'>- RICHMOND MAIL -</font></span></b></p></td>
</tr>
<tr>
<td bgcolor='red' style='border-left-style: none; border-left-width: medium; border-right-style: solid; border-right-width: 1px; border-top-style: solid; border-top-width: 1px; border-bottom-style: solid; border-bottom-width: 1px'>
<p align='center'>
<span style='font-weight: 700; background-color: 'red'>
<font size='2' color='black'>COMUNICACIONES PROFESORADO - E.U.A. RELACIONES LABORALES,
TRABAJO SOCIAL Y TURISMO</font></span></p></td>
</tr>
<tr>
<td height='16' width='16' style='border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium'>&nbsp;</td>
<td height='9' width='763' style='border-left-style: none; border-left-width: medium; border-bottom-style: solid; border-bottom-width: 1px'>
</td>
</tr>
<tr>
<td height='16' width='16' bgcolor='red' style='border-left-style: solid; border-left-width: 1px; border-right-style: none; border-right-width: medium; border-top-style: solid; border-top-width: 1px; border-bottom-style: none; border-bottom-width: medium'>&nbsp;</td>
<td height='16' width='763' bgcolor='red' style='border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: solid; border-top-width: 1px'>&nbsp;</td>
</tr>
<tr>
<td height='16' width='16' bgcolor='red' style='border-left-style: solid; border-left-width: 1px; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom-style: none; border-bottom-width: medium'>&nbsp;</td>
<td height='343' width='763' style='border-left-style: none; border-left-width: medium' valign='top'>
<font color='blue'>$texto</font></td>
</tr>
</table>";
$mail->WordWrap = 500;
$path = $_FILES['archivo']['tmp_name'];
$nombre = $_FILES['archivo']['name'];
$tipo_archivo = $_FILES['archivo']['type'];
$tamano_archivo = $_FILES['archivo']['size'];
$mail->AddAttachment($path,$nombre,"base64",$tipo_archiv o);
$path2 = $_FILES['archivo2']['tmp_name'];
$nombre2 = $_FILES['archivo2']['name'];
$tipo_archivo2 = $_FILES['archivo2']['type'];
$tamano_archivo = $_FILES['archivo2']['size'];
$mail->AddAttachment($path2,$nombre2,"base64",$tipo_arch ivo2);
if ($_POST['trabajo1']=="ON") {
$archivo = file("1TS.txt");
$lineas = count($archivo);
for($i=0; $i < $lineas; $i++)
{
$mail->addBCC("$archivo[$i]");
}
}
if ($_POST['trabajo2']=="ON") {
$archivo = file("2TS.txt");
$lineas = count($archivo);
for($i=0; $i < $lineas; $i++)
{
$mail->addBCC("$archivo[$i]");
}
}
if ($_POST['trabajo3']=="ON") {
$archivo = file("3TS.txt");
$lineas = count($archivo);
for($i=0; $i < $lineas; $i++)
foreach($archivo){
$mail->addBCC("$archivo[$i]");
}
}
if ($_POST['trabajotarde1']=="ON") {
$archivo = file("1TST.txt");
$lineas = count($archivo);
for($i=0; $i < $lineas; $i++)
{
$mail->addBCC("$archivo[$i]");
}
}
if ($_POST['trabajotarde2']=="ON") {
$archivo = file("2TST.txt");
$lineas = count($archivo);
for($i=0; $i < $lineas; $i++)
{
$mail->addBCC("$archivo[$i]");
}
}
if ($_POST['trabajotarde3']=="ON") {
$archivo = file("3TST.txt");
$lineas = count($archivo);
for($i=0; $i < $lineas; $i++)
{
$mail->addBCC("$archivo[$i]");
}
}
if ($_POST['relaciones1']=="ON") {
$archivo = file("1RL.txt");
$lineas = count($archivo);
for($i=0; $i < $lineas; $i++)
{
$mail->addBCC("$archivo[$i]");
}
}
if ($_POST['relaciones2']=="ON") {
$archivo = file("2RL.txt");
$lineas = count($archivo);
for($i=0; $i < $lineas; $i++)
{
$mail->addBCC("$archivo[$i]");
}
}
if ($_POST['relaciones3']=="ON") {
$archivo = file("3RL.txt");
$lineas = count($archivo);
for($i=0; $i < $lineas; $i++)
{
$mail->addBCC("$archivo[$i]");
}
}
if ($_POST['turismo2']=="ON") {
$archivo = file("2TU.txt");
$lineas = count($archivo);
for($i=0; $i < $lineas; $i++)
{
$mail->addBCC("$archivo[$i]");
}
}
if ($_POST['turismo3']=="ON") {
$archivo = file("3TU.txt");
$lineas = count($archivo);
for($i=0; $i < $lineas; $i++)
{
$mail->addBCC("$archivo[$i]");
}
}
if(!$mail->Send()){
echo "Mailer Error: " . $mail->ErrorInfo;
}else{
echo "Su mensaje ha sido enviado...";
}
?>



Mi problema surge, cuando los del servidor han puesto una limitación de 125 emails, no se si es solo en copia oculta o como, total, ¿hay alguna manera de hacer un envio por bloques e implementarlo con lo que tengo hasta ahora?

Gracias.
  #2 (permalink)  
Antiguo 23/11/2009, 14:26
 
Fecha de Ingreso: mayo-2009
Mensajes: 43
Antigüedad: 14 años, 11 meses
Puntos: 2
Respuesta: ayuda phpmailer

Cita:
Iniciado por EduardoCh Ver Mensaje
Hola a todos,

Os explico, tengo el siguiente codigo:

<?php
$texto = $_POST['texto'];
$edu = $_POST['edu'];
if ($_POST['asignatura']=="") {
$asunto="[RICHMOND] ".$_POST["asunto"];
}
else {
$asunto="[RICHMOND]".$_POST["asignatura"]." - ".$_POST["asunto"];
}
$sender = $_POST['sender'];
$informacion = $_POST['informacion'];
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Host = "*****"; // sets GMAIL as the SMTP server
$mail->Port = 465; // set the SMTP port for the GMAIL server
$mail->IsHTML(true);
$mail->Username = "*****"; // GMAIL username
$mail->Password = "****"; // GMAIL password
$mail->From = $_POST['sender'];
$mail->FromName = $_POST['nombre'];
$mail->Sender = $_POST['sender'];
$mail->Subject = $asunto;
$mail->Body = "<table border='0' cellpadding='0' bordercolor='black' style='border-collapse: collapse'>
<tr>
<td height='51' width='16' bgcolor='black' style='border-left-style: solid; border-left-width: 1px; border-right-style: none; border-right-width: medium; border-top-style: solid; border-top-width: 1px; border-bottom-style: solid; border-bottom-width: 1px' rowspan='2'>&nbsp;</td>
<td bgcolor='red' style='border-left-style: none; border-left-width: medium; border-right-style: solid; border-right-width: 1px; border-top-style: solid; border-top-width: 1px; border-bottom-style: solid; border-bottom-width: 1px'>
<p align='center'><b><span style='background-color: 'red'>
<font size='2' color='black'>- RICHMOND MAIL -</font></span></b></p></td>
</tr>
<tr>
<td bgcolor='red' style='border-left-style: none; border-left-width: medium; border-right-style: solid; border-right-width: 1px; border-top-style: solid; border-top-width: 1px; border-bottom-style: solid; border-bottom-width: 1px'>
<p align='center'>
<span style='font-weight: 700; background-color: 'red'>
<font size='2' color='black'>COMUNICACIONES PROFESORADO - E.U.A. RELACIONES LABORALES,
TRABAJO SOCIAL Y TURISMO</font></span></p></td>
</tr>
<tr>
<td height='16' width='16' style='border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium'>&nbsp;</td>
<td height='9' width='763' style='border-left-style: none; border-left-width: medium; border-bottom-style: solid; border-bottom-width: 1px'>
</td>
</tr>
<tr>
<td height='16' width='16' bgcolor='red' style='border-left-style: solid; border-left-width: 1px; border-right-style: none; border-right-width: medium; border-top-style: solid; border-top-width: 1px; border-bottom-style: none; border-bottom-width: medium'>&nbsp;</td>
<td height='16' width='763' bgcolor='red' style='border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: solid; border-top-width: 1px'>&nbsp;</td>
</tr>
<tr>
<td height='16' width='16' bgcolor='red' style='border-left-style: solid; border-left-width: 1px; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom-style: none; border-bottom-width: medium'>&nbsp;</td>
<td height='343' width='763' style='border-left-style: none; border-left-width: medium' valign='top'>
<font color='blue'>$texto</font></td>
</tr>
</table>";
$mail->WordWrap = 500;
$path = $_FILES['archivo']['tmp_name'];
$nombre = $_FILES['archivo']['name'];
$tipo_archivo = $_FILES['archivo']['type'];
$tamano_archivo = $_FILES['archivo']['size'];
$mail->AddAttachment($path,$nombre,"base64",$tipo_archiv o);
$path2 = $_FILES['archivo2']['tmp_name'];
$nombre2 = $_FILES['archivo2']['name'];
$tipo_archivo2 = $_FILES['archivo2']['type'];
$tamano_archivo = $_FILES['archivo2']['size'];
$mail->AddAttachment($path2,$nombre2,"base64",$tipo_arch ivo2);
if ($_POST['trabajo1']=="ON") {
$archivo = file("1TS.txt");
$lineas = count($archivo);
for($i=0; $i < $lineas; $i++)
{
$mail->addBCC("$archivo[$i]");
}
}
if ($_POST['trabajo2']=="ON") {
$archivo = file("2TS.txt");
$lineas = count($archivo);
for($i=0; $i < $lineas; $i++)
{
$mail->addBCC("$archivo[$i]");
}
}
if ($_POST['trabajo3']=="ON") {
$archivo = file("3TS.txt");
$lineas = count($archivo);
for($i=0; $i < $lineas; $i++)
foreach($archivo){
$mail->addBCC("$archivo[$i]");
}
}
if ($_POST['trabajotarde1']=="ON") {
$archivo = file("1TST.txt");
$lineas = count($archivo);
for($i=0; $i < $lineas; $i++)
{
$mail->addBCC("$archivo[$i]");
}
}
if ($_POST['trabajotarde2']=="ON") {
$archivo = file("2TST.txt");
$lineas = count($archivo);
for($i=0; $i < $lineas; $i++)
{
$mail->addBCC("$archivo[$i]");
}
}
if ($_POST['trabajotarde3']=="ON") {
$archivo = file("3TST.txt");
$lineas = count($archivo);
for($i=0; $i < $lineas; $i++)
{
$mail->addBCC("$archivo[$i]");
}
}
if ($_POST['relaciones1']=="ON") {
$archivo = file("1RL.txt");
$lineas = count($archivo);
for($i=0; $i < $lineas; $i++)
{
$mail->addBCC("$archivo[$i]");
}
}
if ($_POST['relaciones2']=="ON") {
$archivo = file("2RL.txt");
$lineas = count($archivo);
for($i=0; $i < $lineas; $i++)
{
$mail->addBCC("$archivo[$i]");
}
}
if ($_POST['relaciones3']=="ON") {
$archivo = file("3RL.txt");
$lineas = count($archivo);
for($i=0; $i < $lineas; $i++)
{
$mail->addBCC("$archivo[$i]");
}
}
if ($_POST['turismo2']=="ON") {
$archivo = file("2TU.txt");
$lineas = count($archivo);
for($i=0; $i < $lineas; $i++)
{
$mail->addBCC("$archivo[$i]");
}
}
if ($_POST['turismo3']=="ON") {
$archivo = file("3TU.txt");
$lineas = count($archivo);
for($i=0; $i < $lineas; $i++)
{
$mail->addBCC("$archivo[$i]");
}
}
if(!$mail->Send()){
echo "Mailer Error: " . $mail->ErrorInfo;
}else{
echo "Su mensaje ha sido enviado...";
}
?>



Mi problema surge, cuando los del servidor han puesto una limitación de 125 emails, no se si es solo en copia oculta o como, total, ¿hay alguna manera de hacer un envio por bloques e implementarlo con lo que tengo hasta ahora?

Gracias.
Lo he cambiado y me pasa lo mismo, he puesto esto:

{
$archivo = file("1TS.txt");
$i=0;
while ($archivo[$i]){
$mail->AddBCC($archivo[$i]);
$i++;
}
}
  #3 (permalink)  
Antiguo 23/11/2009, 14:46
 
Fecha de Ingreso: mayo-2009
Mensajes: 43
Antigüedad: 14 años, 11 meses
Puntos: 2
Respuesta: ayuda phpmailer

Cita:
Iniciado por EduardoCh Ver Mensaje
Lo he cambiado y me pasa lo mismo, he puesto esto:

{
$archivo = file("1TS.txt");
$i=0;
while ($archivo[$i]){
$mail->AddBCC($archivo[$i]);
$i++;
}
}
$mail->ClearAddresses();

eso tampoco
  #4 (permalink)  
Antiguo 23/11/2009, 16:16
 
Fecha de Ingreso: mayo-2009
Mensajes: 43
Antigüedad: 14 años, 11 meses
Puntos: 2
Respuesta: ayuda phpmailer

Mailer Error: Error SMTP: Los siguientes destinatarios fallaron: Array


ahora eso...:(
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 13:50.