i want to send the newsletter to all those who subscribe to my website.
i ahve a templetae with table navigation ,site logo,some images.
i wnat to send news letter with all this . i create the html file .
can i do thsi code to send

<?INCLUDE 'd.php';
$title=$_GET;


$sel=mysql_query("select * from news where title='$title'") or die("no");
$n1=mysql_num_rows($sel);
$i1=0;


while($i1<$n1)
{
$news=mysql_result($sel,$i1,"news");
$title=mysql_result($sel,$i1, "title");

$i1++;
}


$sel=mysql_query("select * from newemail");
$n=mysql_num_rows($sel);
$i=0;
while($i<$n)
{
$to=mysql_result($sel,$i,"email");
$name=mysql_result($sel,$i,"name");

the main logic i am thinking to send to the subscriber

$message=" Dear $name <br><br>

include 'newsletter.html'";

// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";


$headers .= 'From:mysite.com <customer@mysite.com>' . "\r\n";

$subject="News letter from mysite";

mail($to, $subject, $message, $headers);
print "Newsletter is sent to $to";print "<br>";
$i++;
}

?>

find the procedure here :
1. get the contents of the html file
$StaticContent = file_get_contents('newsletter.html');
2. set the header
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
3.use the mail function
mail($to, $subject, $StaticContent , $headers, $additional_parameter_if_required);


For guide on how the html newsletter should be written refer

http://www.knowledge-transfers.com/it/how-to-write-a-html-newsletter

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.