User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 373,462 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,959 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting

Need help NEWSLETTER

Join Date: Oct 2007
Posts: 16
Reputation: Cente is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
Cente Cente is offline Offline
Newbie Poster

Help Need help NEWSLETTER

  #1  
Jan 15th, 2008
Please need help I have an code for send a newsletter by the help of a good friend, but when I tried looks fine and when I open the email I received contain the newsletter picture are not appeared all necessary image are also uploaded in the same folder.

PHP CODE:

<?php

$file = 'newsletter.html';
$open = fopen($file, 'r');
$read = fread($open, filesize($file));
fclose($open);
$message =<<<MES
$read
MES;

$from = 'sender';

$subject = 'Newsletter';
$headers = "From: $from\r\n";
$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

$hostname='h41mysql59.secureserver.net';
$username='qwertyuiop';
$password='*****';
$dbname='qwertyuiop';
$usertable='email';
$yourfield = 'email';

$con = mysql_connect("$hostname","$username","$password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}


$database = mysql_select_db('qwertyuiop', $con);
if (!$database) {
echo "DATABASE COULDN'T BE SELECTED";
}
$sql = "SELECT * FROM email";
$query = mysql_query($sql);
while ($row = mysql_fetch_assoc($query)) {
$to = $row['email'];
$mail = mail($to, $subject, $message, $headers);
}
if ($mail) {
echo 'All (' . mysql_num_rows($query) . ') Messages sent successfully';
}
mysql_close($con);
?>

NEWSLETTER HTML CODE

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>sample</title>
<style type="text/css">
<!--
body {
background-color: #000066;
}
.style1 {
color: #FFFFFF;
font-size: xx-large;
}
.style2 {
font-size: 12px;
color: #CCCCCC;
}
-->
</style></head>

<body>
<table width="596" height="248" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<th scope="row"><p class="style1">Sample</p>
<p class="style1">&nbsp;</p>
</th>
</tr>
</table>
<table width="500" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<th background="images/newsletter_01.gif" scope="row"><p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp; </p></th>
</tr>
</table>
</body>
</html>
AddThis Social Bookmark Button
Reply With Quote  
All times are GMT -4. The time now is 5:08 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC