email a web page
| From: | DC | Date: | Mon, 06 Jan 2003 10:06:45 +0000 |
| Subject: | email a web page | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-130374@lists.php.net to get a copy of this message | ||
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<dcurran@powerup.com.au>\n";
$headers .= "X-Sender: <dcurran@powerup.com.au>\n";
$headers .= "X-Mailer: testDC\n";
$headers .= "Return-Path: <dcurran@powerup.com.au>\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