 |
Foro de Posicionamiento y Buscadores Aprendiendo a Promocionar Páginas Web. Xeoweb :: Sindicar
|
| Ver tema anterior :: Ver tema siguiente |
| Autor |
Mensaje |
ping Me gusta MSN!
Registrado: 01 Jul 2006 Mensajes: 344 Ubicación: Galicia
|
Publicado: Dom Ene 04, 2009 3:28 pm Asunto: Enviar un correo a todos los usuarios. |
|
|
Hola tengo un portal con una gran cantidad de usuarios registrados entorno a 83.000 me gustaría enviarles un mensaje de correo para informar de los nuevos cambios y políticas.
Como puedo realizar ese codigo?
Alguna ayuda?
Un saludo gracias. _________________ Chatear
Codigo |
|
| Volver arriba |
|
 |
makinovic Todavía uso Altavista
Registrado: 06 Oct 2008 Mensajes: 62 Ubicación: Alicante
|
Publicado: Mie Ene 07, 2009 8:51 am Asunto: |
|
|
| Con que está programado tu portal, ¿php?¿Asp?... si es php te puedo enviar un código que programé no hace mucho para lo que quieres hacer. |
|
| Volver arriba |
|
 |
ping Me gusta MSN!
Registrado: 01 Jul 2006 Mensajes: 344 Ubicación: Galicia
|
Publicado: Mie Ene 07, 2009 2:30 pm Asunto: |
|
|
en php, pues si me lo envías me haces un gran favor. Los usuarios estan compartidos con los de un foro smf pero usando el boletin de dicho foro me da error de memoria, deben ser demasiados.
Un saludo y gracias. _________________ Chatear
Codigo |
|
| Volver arriba |
|
 |
makinovic Todavía uso Altavista
Registrado: 06 Oct 2008 Mensajes: 62 Ubicación: Alicante
|
Publicado: Mie Ene 07, 2009 9:43 pm Asunto: |
|
|
Para realizar envios masivos utilicé la clase htmlmimemail que me permitía enviar mail en html
La clase te la puedes descargar gratis de aqui:
http://www.phpguru.org/downloads/html.mime.mail/
Te viene la versión para php4 y para php5
El código podría ser así:
| Código: |
<?
<?
if (isset($submit)){
$connect = mysql_connect("localhost","USUARIO","CONTRASEÑA") or die ("no puedo conectar con la base de datos"); //conecta con MySql
mysql_select_db("BASE_DE_DATOS");
//Aqui seleccionamos el campo mail de la base de datos
$sql1=mysql_query("SELECT mail FROM tabla_que_contiene_los_mails") or die(mysql_error());
// MUCHO CUIDADO, ES UN BUCLE, SI SE EJECUTA, SE ENVIARA EL AMIL A TODAS LAS DIRECCIONES DE LA BASE DE DATOS
while ($sql=mysql_fetch_array($sql1)){
/**
* o------------------------------------------------------------------------------o
* | This package is dual licensed as GPL and a commercial license. |
* | If you use the code commercially (or if you don't want to be restricted by |
* | the GPL license), you will need the commercial license. It's only #49 (GBP - |
* | roughly $98 depending on the exchange rate) and helps me out a lot. Thanks. |
* o------------------------------------------------------------------------------o
*
* ) Copyright Richard Heyes
*/
error_reporting(E_ALL);
require_once('htmlMimeMail/htmlMimeMail.php');
/**
* Example of usage. This example shows
* how to use the class with html,
* embedded images, no attachments, but
* using the third argument of setHtml(),
* which will try to automatically find the
* images (though not limited to images),
* and embed them. It will send the mail
* using built in php mail() functionality.
*
* Create the mail object.
* No header argument any more
*/
$mail = new htmlMimeMail();
/**
* Read the image background.gif into
* $background
*/
/**
* If sending an html email, then these
* two variables specify the text and
* html versions of the mail. Don't
* have to be named as these are. Just
* make sure the names tie in to the
* $mail->setHtml() call further down.
*/
$text = $mail->getFile('example.txt');
//Aqui metemos el código html con el contenido del mail
$html = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>
</head>
<body>
esto es una prueba
</body>
</html>
';
/**
* Add the text, html and embedded images.
* Here we're using the third argument of
* setHtml(), which is the path to the
* directory that holds the images. By
* adding this third argument, the class
* will try to find all the images in the
* html, and auto load them in. Not 100%
* accurate, and you MUST enclose your
* image references in quotes, so src="img.jpg"
* and NOT src=img.jpg. Also, where possible,
* duplicates will be avoided.
*/
$mail->setHtml($html, $text, './');
/**
* Sends the message.
*/
// IGUALAMOS $CORREO A LO QUE CONTENGA EL CAMPO 'mail'
$correo=$sql["mail"];
//ORIGEN DEL MAIL
$mail->setFrom('Mi página web <info@mipaginaweb.com>');
//EL ASUNTO
$mail->setSubject('Esto es una prueba desde mi página web');
$result = $mail->send(array($correo));
//ESTO ES UN RETARDO PARA EVITAR QUE SALGAN TODOS LOS MAILS DEMASIADO RAPIDO Y PUEDA SALTAR LAS ALARMAS DE SPAM
time_nanosleep(10, 100000);
}
echo "Los mails se han enviado";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Isla Marina</title>
<link href="css/bauksar.css" rel="stylesheet" type="text/css">
</head>
<style type="text/css">
<!--
body {
background-color: #f8f5f5;
}
.texto {
font-family: "Trebuchet MS", Verdana;
font-size: 11px;
color: #333333;
}
.enlace {
font-family: "Trebuchet MS", Verdana;
font-size: 11px;
color: #DA690E;
text-decoration: underline;
}
form {
margin: 0px;
padding: 0px;
}
-->
</style>
<html>
<body topmargin="100">
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td> </td>
<td width="450" align="left" valign="top"><table width="450" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="250" align="left"> </td>
<td width="200" align="right" valign="bottom" class="texto"><br /></td>
</tr>
<tr>
<td colspan="2"><form name="form" action="envio2.php" method="post" >
<table width="450" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="25" bgcolor="f2842b"style="border-right: 2px solid #666666;"><div align="center"></div></td>
</tr>
<tr>
<td height="25" bgcolor="f2842b"style="border-right: 2px solid #666666;">Envio de E-mails</td>
</tr>
<tr>
<td bgcolor="f2842b"style="border-right: 2px solid #666666;"> </td>
</tr>
<tr>
<td bgcolor="f2842b"style="border-right: 2px solid #666666;"><strong>EL BOTON DEBES PULSARLO SOLAMENTE UNA VEZ!!</strong></td>
</tr>
<tr>
<td bgcolor="f2842b"style="border-right: 2px solid #666666;">o mandarás repetido el email a los destinatarios</td>
</tr>
<tr>
<td bgcolor="f2842b"style="border-right: 2px solid #666666;"> </td>
</tr>
<tr>
<td height="30" valign="top" align="center" bgcolor="f2842b"style="border-bottom: 2px solid #666666;border-right: 2px solid #666666;"><input name="submit" type="submit" value="Enviar mails" /></td>
</tr>
</table>
</form></td>
</tr>
<tr>
<td colspan="2" align="left" class="texto"> </td>
</tr>
</table></td>
<td> </td>
</tr>
</table>
<br />
</body>
</html> |
Ten mucho cuidado cuando hagas las pruebas, este código envia el mail a todas las direcciones que aparezcan en la base de datos. Quita el bucle WHILE cuando hagas las pruebas antes de nada.
Espero que te sirva o que al menos te ayude un poco en lo que quieres hacer.
Un saludo |
|
| Volver arriba |
|
 |
|
| Respuesta Rápida y Acciones |
| |
|
|
Página 1 de 1
Puede publicar nuevos temas en este foro No puede responder a temas en este foro No puede editar sus mensajes en este foro No puede borrar sus mensajes en este foro No puede votar en encuestas en este foro
|
|
Logo diseñado por iLevante
Powered by phpBB © 2001, 2009 phpBB Group
|