Hi all,
I have a newsletter ready to email to my database of customers.
The entire newsletter incl graphics , layout etc is enclosed within a form
which posts to a second page which s supposed to email the desired
page..........but it does not work! The code is listed below........
_______________________________________________________
<?php
$dbcnx = @mysql_connect("localhost","", "");
if (!$dbcnx) {
echo( "<P>Unable to connect to the " .
"database server at this time.</P>" );
exit();
}
if (! @mysql_select_db("NameOfDataBase") )
{
echo( "<P>Unable to locate the " .
"database at this time.</P>" );
exit();
}
?>
<?
// HTML VERSION
$result = mysql_query(
"SELECT EmailAddress FROM emailbasketrecipient");
if (!$result)
{
echo("<P>Error performing query: " .
mysql_error() . "</P>");
exit();
}
while ( $row = mysql_fetch_array($result) )
{
$message = "
<html>
<head>
<title>::: Welcome to my Newsletter :::</title>
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>
</head>
<body>
<div align='center'>
<table width='750' border='0' cellspacing='0' cellpadding='0'
height='162'>
content content etc
</table>
</div>
</body>
</html>
";
$email = $row["EmailAddress"];
(line 79) $headers .= "From: My site.com<[EMAIL PROTECTED]>\n";
$headers .= "X-Sender: <[EMAIL PROTECTED]>\n";
$headers .= "X-Mailer: testDC\n";
$headers .= "Return-Path: <[EMAIL PROTECTED]>\n";
$headers .= "Content-Type: text/html; charset=iso-8859-1\n";
$subject = " Club Newsletter";
(line 91) mail($email, $subject , $message, $headers);
$headers = "";
}
echo("$message");
?>
_________________________________________________________
and then I get this message each time.........
Warning: Undefined variable: headers in
c:\www\cavalier\admin\newsletteremailcommand.php on line 79
Warning: Failed to Connect in
c:\www\cavalier\admin\newsletteremailcommand.php on line 91
Any quick and easy tips to get my newsletter happening? Even a new script or
easy tutorial in Englsih.
Thanks
DC
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php