I send out text emails each week for the school. I want to change to html newsletters, sending them out with my brief php script.
I've read of the difficulties with coding, and have worked my way round that. But I can't find the piece of coding that would send it out - taking the list from a mysql table.
This is my text newsletter code which works really well ...
$query = 'SELECT * FROM reg';
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
// Goes through each result sending them the message
while($row = mysql_fetch_array($result))
// was array tried assoc
{
$subject = "Willowfield newsletter - Sunday January 7 2007.";
$message = "Dear $row[username],\n
newsletter here
\r\n";
$headers = 'From: Willowfield website';
$message.= "(Thank you, $row[fname] $row[sname], for being part of Willowfield’s email newsletter list.)";
mail($row[email], $subject, $message, $headers);
$subject.="copies from " . $row[email];
mail("paulrster@gmail.com", $subject, $message, $headers);
}
I really have spent hours working on this ... but keep being stymied by the code. Be grateful for some guidance.