Per fare prima, il codice è:
Codice PHP:
<?php
// read the list of emails from the file.
$email_list = file("elist.txt");
// count how many emails there are.
$total_emails = count($email_list);
// go through the list and trim off the newline character.
for ($counter=0; $counter<$total_emails; $counter++) {
$email_list[$counter] = trim($email_list[$counter]);
}
// implode the list into a single variable, put commas in, apply as $to value.
$to = implode(",",$email_list);
$subject = "BOLLETTINO Angeli per un giorno";
$message = "<html><body>
ciao mondo</p></body></html>";
$headers = 'From: [email]bollettino@xxxxx.it[/email]' . "\r\n";
$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
if ( mail($to,$subject,$message,$headers) ) {
echo "The email has been sent!";
} else {
echo "The email has failed!";
}
?>