Mysql
 sql >> Database >  >> RDS >> Mysql

Seleziona e invia la posta dal mio database

Prova qualcosa del genere:

<?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();
?>