Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all articles
Browse latest Browse all 29767

Send email to all email address from MySQL using PHP

$
0
0

I am trying to send email to All users from Mysql Database. For this I have written below Code, but it is sending email to First record only. What's wrong I am doing. I need to send email to all users.

if ($_POST['do'] == 'mail') {


$result = $db->query("SELECT email FROM members WHERE status='Active'");

$input="This is a text message";

       $userdetails = $db->fetch_array($result);

       $emails = implode(",", $userdetails);

        $message = $input;
        $mail = new mail();
        $mail->setFrom($settings['email_support'], $input->pc['name']);
        $mail->addTo($emails);
        $mail->setSubject('subject text!');
        $mail->setBodyText($message);
        $mail->send();
}

Viewing all articles
Browse latest Browse all 29767

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>