= DATE_SUB(curdate(),INTERVAL 7 day)";
$result2=MySQL_query($sql2);
while($myrow=MySQL_fetch_array($result2))
{
$post_date=$myrow["post_date"];
$title=$myrow["post_title"];
$content=strip_tags($myrow["post_content"]);
$content = str_replace("Â", "", "$content");
$guid=$myrow["guid"];
// this limits the content to 50 words max. You can change this
$threshold_length = 50;
$phrase = "$content";
$abody = str_word_count($phrase,2);
if(count($abody) >= $threshold_length){
$tbody = array_keys($abody);
$content = substr($phrase,0,$tbody[$threshold_length]);
}
else {
$content = $phrase;
}
// this is the main content of the email
$main .= "$title
$content... You can learn more here.
";
}
//put the footer of your email in the quotes below
$headers = "MIME-Version: 1.0\n" ;
//set the from as who you want the newsletter to be sent from
$headers .= "From: newsletter@test.com\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
//you can change the email subject below to be what you want
mail("$email","Email Subject", "$main", "$headers");
//set a cron to run it weekly and tada
//note sure how do that, then ask your host
?>