send multiple emails

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
josecnp1
User
Posts: 73

send multiple emails

Post by josecnp1 »

i try to send multiple emails of a selected database to all recipients
i am inspired in this link, viewtopic.php?f=4&t=33248&p=94120&hilit=recipient#p94120
my code is:

// Email Sending event
function Email_Sending(&$Email, &$Args) {

$sSql = "SELECT `correoelectronico` FROM `propiedades`";
if ($rs = ew_Execute($sSql)) {
$rs->MoveFirst();
$emails = "";
while (!$rs->EOF) {
$emails .= $rs->fields("correoelectronico")."<br>"; // get the value of "email" field
$rs->MoveNext();
}  
echo $emails; // display it to the screen
$rs->Close();
} else {
$this->setFailureMessage("No hay correos disponibles.");
}

$Email->Recipient = $emails;                  
$Email->Sender = $recipientsemail = CurrentUserInfo("correoelectronico"); 
$Email->Subject = "Nuevo elemento añadido en Tablon de Anuncios"; 
$Email->ReplaceContent("<!--titulo-->", "\n". "Titulo del Anuncio:" . " " . $Args['rsnew']['descripcion']);
$Email->ReplaceContent("<!--autor-->", "\n\r". "Nombre del autor: " . " " . $nombre = CurrentUserInfo("nombre"));
                                     
	return TRUE;                                                                                              
}   

but I get the following error: You must provide at least one recipient email address.
I'm doing something wrong?


scs
User
Posts: 694

Post by scs »

josecnp1 wrote:
$emails .= $rs->fields("correoelectronico")."<br>"; // get the value of "email" field

I think multiple emails should separated by ; not just <br>

Please give it a try

Hope this help


josecnp1
User
Posts: 73

Post by josecnp1 »

Thanks, that is what I need :-)


Post Reply