Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

187
Vistas
How do i send mails to multiple recipients

I am trying to simulate an email behavior using a database. These are the codes i used for sending mail to one recipient. How do i send it to multiple recipients.

    if($to=="" || $sub=="" || $msg=="")
    {
        $err= "<h3 style='color:red'>fill the related data first</h3>";
    }
    else
    {   
        $d=mysqli_query($con,"SELECT * FROM userinfo where email='$to'");
        $row=mysqli_num_rows($d);
        if($row==1)
        {
            mysqli_query($con,"INSERT INTO usermail values('','$to','$id','$sub','$msg','$file',sysdate())");

            $err= "<h3 style='color:blue'>Message sent...</h3>";
        }
        else
        {
            $sub=$sub."--"."msg failed";
            mysqli_query($con,"INSERT INTO usermail values('','$id','$id','$sub','$msg','$file',sysdate())");
            $err= "<h3 style='color:red'>Message failed because reciever not found...</h3>";
        }   
    }
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

If i got your problem:

Lets say $to="abc@x.com;zdf@x.com";

else
{ 
   $toStack = explode(';',$to);
   foreach($toStack as $to){
     $d=mysqli_query($con,"SELECT * FROM userinfo where email='$to'");
     /** and the rest of your code from the else block **/
   }
}

have a nice day..

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda