buongiorno.
dovrei fare un invio multiplo di email prendendo tutti gli indirizzi da un db.
premetto che non posso usare PHPMailer sennò avrei già risolto.
quindi devo usare la funzione mail() di PHP.
ho provato così:
sendUtenti() mi interroga il db.Codice PHP:function sendUtenti() {
global $config;
try {
$result = $config->getPdo()->query("SELECT * FROM newsletter");
return $result;
} catch (PDOException $e) {
echo '<script type="text/javascript">alert("' . $e->getMessage() . '");</script>';
die();
}
}
function sendEmail($subject, $message) {
$header = "From: Azienda <info@azienda.it>";
$to = array();
foreach (sendUtenti() as $send) {
$to = $send['nl_email'] . ', ';
}
mail($to, $subject, $message, $headers);
}
quando faccio il submit del form nn ho errori ma le email nn arrivano.

Rispondi quotando