Re: email a web page

From: Date: Tue, 07 Jan 2003 13:58:07 +0000
Subject: Re: email a web page
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-130575@lists.php.net to get a copy of this message
"Dc" <dcurran@powerup.com.au> wrote in message news:20030106100453.3608.qmail@pb1.pair.com... > 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 > > > > try and change your first $headers .= "stuff" to $headers = "stuff"; --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.431 / Virus Database: 242 - Release Date: 17/12/02

« previous php.general (#130575) next »