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';

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

$title=mysql_result($sel,$i1, "title");


$sel=mysql_query("select * from newemail");

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>";


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


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.