Mysql
 sql >> Base de Dados >  >> RDS >> Mysql

Selecionar e enviar e-mails do meu banco de dados


Tente algo assim:
<?php
    function sendEmailTech() {
        $select = $this->pdo->query("SELECT email FROM tbl_tech_email");
        $select = $select->fetchAll();
        if(count($select) > 0) {
            foreach($select AS $recipient) {
                mail($recipient["email"], "My Info", "Hello, I just sent a mail to You");
            }
        } else {
            echo "No user to send email";
            die();
        }
    }
    // sendEmailTech();
?>