<?php
ini_set( "max_execution_time", 3600 );
require("class.phpmailer.php");

$mail = new phpmailer();

$mail->From       = "eBlast@kidspages.org";
$mail->AddReplyTo = "eBlast@kidspages.org";
$mail->FromName   = "Kids' Pages Family";
$mail->Mailer     = "mail";

@MYSQL_CONNECT( "localhost", "kp_pnmonkey", "buster" );
@mysql_select_db( "kp_phoenix" );

$query = "select distinct email_address from kp_emails where ( email_address not in (select email_address from kp_emails_block) ) and ( email_address not in (select email from kp_ebook_unsubscribe) ) and ( email_address not in (select email from kp_ebook_sent ) )";

// $query = "select distinct email_address from kp_emails where email_address not in (select email_address from kp_emails_block)";
// $query = "select distinct email_address from kp_emails where ( email_address not in (select email_address from kp_emails_block) ) and ( email_address not in (select email from kp_ebook_unsubscribe) )"

echo '### Start: ' . date('l jS \of F Y h:i:s A') . "<br />";

$result = @MYSQL_QUERY($query);

$numrows = mysql_num_rows( $result );
echo "$numrows addresses to process... <br />";
$count = 0;

while ( $row = mysql_fetch_array ( $result ) )
{
  $email_address = $row["email_address"];
  $count++;

// HTML body
$body =
<<<EOT


<html>
<head>
  <title>KidsPages.org - October Events for Family Fun</title>
</head>

<body>
  <table border="0" cellpadding="0" cellspacing="0" width="100%">
    <tr>
      <td align="center" bgcolor="#FFFFFF">
        <table border="0" cellpadding="0" cellspacing="0" width="575">
          <tr>
            <td align="left" bgcolor="#FFFFFF" height="50" valign="top"><a href="http://kidspages.org" target="_blank"><img alt="kidspages.org" src="http://kidspages.org/newsletter/images/2008-10-01/KidsPagesLogo-0810.gif" width="352" height="80" border="0" /></a></td>
            <td align="right" bgcolor="#FFFFFF" height="50" style="line-height:0px; font-size:0px;" valign="top">&nbsp;</td>
          </tr>

          <tr>
            <td colspan="2">
              <hr color="#B7CD60" noshade="noshade" size="1px">
            </td>
          </tr>

          <tr>
            <td colspan="2">
              <div style="font-family:Arial, Helvetica, sans-serif;font-size:25px;font-weight:bold;padding-bottom:6px;color:#594022;">
                <div style="font-size:15px;color:black;line-height:150%;">
<p style="margin: 0 0 4px 0"><a href="http://KidsPages.org" target="_blank">Click here</a> to visit your Family Resource!</p>
                </div>
              </div>
            </td>
          </tr>

          <tr>
            <td height="100%" valign="top">
              <table border="0" cellpadding="0" cellspacing="0" width="100%">

                <!-- section 0 -->
                <tr>
                  <td align="left" bgcolor="#FFFFFF" height="100%">
                    <table border="0" cellpadding="0" cellspacing="0" height="100%" width="381">
                      <tr>
                        <td colspan="2" height="12" rowspan="2" style="line-height:0px; font-size:0px;" width="12"><img height="12" src="http://kidspages.org/newsletter/images/2008-04-01/color001_ul_corner.jpg" width="12" alt="" /></td>
                        <td bgcolor="#9A9B96" height="1px" style="line-height:0px; font-size:0px;" width="357"></td>
                        <td colspan="2" height="12" rowspan="2" style="line-height:0px; font-size:0px;" width="12"><img height="12" src="http://kidspages.org/newsletter/images/2008-04-01/color001_ur_corner.jpg" width="12" alt="" /></td>
                      </tr>

                      <tr>
                        <td bgcolor="#E2E5D2" height="11" style="line-height:0px; font-size:0px;"></td>
                      </tr>

                      <tr>
                        <td bgcolor="#9A9B96" height="100%" style="line-height:0px; font-size:0px;" width="1"></td>
                        <td bgcolor="#E2E5D2" height="100%" style="line-height:0px; font-size:0px;" width="11"></td>

                        <td align="left" bgcolor="#E2E5D2" height="100%" style="font-size: 12px; color:#343436; line-height:16px;" valign="top">
                          <font style="font-family:Arial, Helvetica, sans-serif;font-size:14px;">

                            <div style="clear:both;text-align:center;">
                              <a href="http://kidspages.org/blog/cindyj" target="_blank"><img src="http://kidspages.org/newsletter/images/2008-10-15/CindySez081015.gif" width="351" height="80" border="0" alt="" /></a>
<br />
<div style="font-size:11px;font-weight:bold;line-height:150%;margin-top:4px;">
<strong>
Remember to check <a href="http://kidspages.org/event-calendar" target="_blank">Kids' Pages Family Event Calendar</a><br />every day for new additions!
</strong>
</div>
                            </div>



                          </font>

                        </td>

                        <td bgcolor="#E2E5D2" height="100%" width="11"></td>
                        <td bgcolor="#9A9B96" height="100%" width="1"></td>
                      </tr>

                      <tr>
                        <td colspan="5" style="line-height:0px; font-size:0px;"><img height="12" src="http://kidspages.org/newsletter/images/2008-04-01/color001_bottom.jpg" width="381" alt="" /></td>
                      </tr>

                      <tr>
                        <td colspan="5" style="line-height:0px; font-size:0px;"><img height="14" src="http://kidspages.org/newsletter/images/2008-04-01/pix.gif" width="1" alt="" /></td>
                      </tr>

                    </table>
                  </td>
                </tr>
                <!-- /section 0 -->


                <!-- section 1 -->
                <tr>
                  <td align="left" bgcolor="#FFFFFF" height="100%">
                    <table border="0" cellpadding="0" cellspacing="0" height="100%" width="381">
                      <tr>
                        <td colspan="2" height="12" rowspan="2" style="line-height:0px; font-size:0px;" width="12"><img height="12" src="http://kidspages.org/newsletter/images/2008-04-01/color001_ul_corner.jpg" width="12" alt="" /></td>
                        <td bgcolor="#9A9B96" height="1px" style="line-height:0px; font-size:0px;" width="357"></td>
                        <td colspan="2" height="12" rowspan="2" style="line-height:0px; font-size:0px;" width="12"><img height="12" src="http://kidspages.org/newsletter/images/2008-04-01/color001_ur_corner.jpg" width="12" alt="" /></td>
                      </tr>
                      <tr><td bgcolor="#E2E5D2" height="11" style="line-height:0px; font-size:0px;"></td></tr>
                      <tr>
                        <td bgcolor="#9A9B96" height="100%" style="line-height:0px; font-size:0px;" width="1"></td><td bgcolor="#E2E5D2" height="100%" style="line-height:0px; font-size:0px;" width="11"></td>

                        <td align="left" bgcolor="#E2E5D2" height="100%" style="font-size: 12px; color:#343436; line-height:16px;" valign="top">
                          <div style="font-family:Arial, Helvetica, sans-serif;font-size:25px;line-height:22px;font-weight:bold;padding-bottom:2px;color:#005bab;">
                            Denver Botanic Gardens and the Denver Zoo
                          </div>

                          <font style="font-family:Arial, Helvetica, sans-serif;font-size:14px;line-height:21px;">


<strong>Saturday, October 18</strong><br />

<div style="float:right;padding: 5px 0px 5px 5px;"><a href="http://botanicgardens.org" target="_blank"><img src="http://kidspages.org/newsletter/images/2008-10-15/BotanicGardensUrbanNature.jpg" width="175" height="111" border="0" alt="" /></a></div>
<br />

Enjoy a FREE visit to <a href="http://botanicgardens.org" target="_blank">Denver Botanic Gardens</a> for the "Urban Nature" Exhibit, and see how the urban of the city and beauty of nature collide when vibrantly colored mural paintings are displayed throughout the gardens.<br />

<div style="float:left;padding: 5px 5px 5px 0px;"><a href="http://www.denverzoo.org" target="_blank"><img src="http://kidspages.org/newsletter/images/2008-10-15/zooredpandacubs.jpg" width="150" height="125" border="0" alt="" /></a></div>
While you're in the area, stop by the <a href="http://www.denverzoo.org" target="_blank">Denver Zoo</a>, where you might get a peek at the Zoo's new twin red panda cubs, Amaya and Takeo, FREE!<br />

<br />

                          </font>
                        </td>

                        <td bgcolor="#E2E5D2" height="100%" width="11"></td><td bgcolor="#9A9B96" height="100%" width="1"></td>
                      </tr>
                      <tr><td colspan="5" style="line-height:0px; font-size:0px;"><img height="12" src="http://kidspages.org/newsletter/images/2008-04-01/color001_bottom.jpg" width="381" alt="" /></td></tr>
                      <tr><td colspan="5" style="line-height:0px; font-size:0px;"><img height="14" src="http://kidspages.org/newsletter/images/2008-04-01/pix.gif" width="1" alt="" /></td></tr>
                    </table>
                  </td>
                </tr>
                <!-- /section 1 -->

                <!-- section 2 -->
                <tr>
                  <td align="left" bgcolor="#FFFFFF" height="100%">
                    <table border="0" cellpadding="0" cellspacing="0" height="100%" width="381">
                      <tr>
                        <td colspan="2" height="12" rowspan="2" style="line-height:0px; font-size:0px;" width="12"><img height="12" src="http://kidspages.org/newsletter/images/2008-04-01/color001_ul_corner.jpg" width="12" alt="" /></td>
                        <td bgcolor="#9A9B96" height="1px" style="line-height:0px; font-size:0px;" width="357"></td>
                        <td colspan="2" height="12" rowspan="2" style="line-height:0px; font-size:0px;" width="12"><img height="12" src="http://kidspages.org/newsletter/images/2008-04-01/color001_ur_corner.jpg" width="12" alt="" /></td>
                      </tr>
                      <tr><td bgcolor="#E2E5D2" height="11" style="line-height:0px; font-size:0px;"></td></tr>
                      <tr>
                        <td bgcolor="#9A9B96" height="100%" style="line-height:0px; font-size:0px;" width="1"></td><td bgcolor="#E2E5D2" height="100%" style="line-height:0px; font-size:0px;" width="11"></td>

                        <td align="left" bgcolor="#E2E5D2" height="100%" style="font-size: 12px; color:#343436; line-height:16px;" valign="top">
                          <div style="font-family:Arial, Helvetica, sans-serif;font-size:25px;line-height:22px;font-weight:bold;padding-bottom:2px;color:#005bab;">
                            Denver Museum of Nature and Science
                          </div>

                          <font style="font-family:Arial, Helvetica, sans-serif;font-size:14px;line-height:21px;">



<strong>Wednesday, October 22</strong><br />

<div style="float:right;padding: 5px 0px 5px 5px;"><a href="http://dmns.org" target="_blank"><img src="http://kidspages.org/newsletter/images/2008-10-15/DMNS.jpg" width="175" height="125" border="0" alt="" /></a></div>
<br />
Enjoy a FREE visit to the <a href="http://dmns.org" target="_blank">Denver Museum of Nature and Science</a>, where you can experience the wonders of the prehistoric world before ever stepping foot inside the Museum! Dinosaurs have invaded the parking garage! Once inside, you'll learn how scientists are unlocking the secrets of dinosaur behavior using new approaches and new technologies. And the kids can participate in the Dinosaur Gulch Dig Site and make their own plaster casts of real fossils!<br />

                          </font>
                        </td>

                        <td bgcolor="#E2E5D2" height="100%" width="11"></td><td bgcolor="#9A9B96" height="100%" width="1"></td>
                      </tr>
                      <tr><td colspan="5" style="line-height:0px; font-size:0px;"><img height="12" src="http://kidspages.org/newsletter/images/2008-04-01/color001_bottom.jpg" width="381" alt="" /></td></tr>
                      <tr><td colspan="5" style="line-height:0px; font-size:0px;"><img height="14" src="http://kidspages.org/newsletter/images/2008-04-01/pix.gif" width="1" alt="" /></td></tr>
                    </table>
                  </td>
                </tr>
                <!-- /section 2 -->

                <!-- section 3 -->
                <tr>
                  <td align="left" bgcolor="#FFFFFF" height="100%">
                    <table border="0" cellpadding="0" cellspacing="0" height="100%" width="381">
                      <tr>
                        <td colspan="2" height="12" rowspan="2" style="line-height:0px; font-size:0px;" width="12"><img height="12" src="http://kidspages.org/newsletter/images/2008-04-01/color001_ul_corner.jpg" width="12" alt="" /></td>
                        <td bgcolor="#9A9B96" height="1px" style="line-height:0px; font-size:0px;" width="357"></td>
                        <td colspan="2" height="12" rowspan="2" style="line-height:0px; font-size:0px;" width="12"><img height="12" src="http://kidspages.org/newsletter/images/2008-04-01/color001_ur_corner.jpg" width="12" alt="" /></td>
                      </tr>
                      <tr><td bgcolor="#E2E5D2" height="11" style="line-height:0px; font-size:0px;"></td></tr>
                      <tr>
                        <td bgcolor="#9A9B96" height="100%" style="line-height:0px; font-size:0px;" width="1"></td><td bgcolor="#E2E5D2" height="100%" style="line-height:0px; font-size:0px;" width="11"></td>

                        <td align="left" bgcolor="#E2E5D2" height="100%" style="font-size: 12px; color:#343436; line-height:16px;" valign="top">
                          <div style="font-family:Arial, Helvetica, sans-serif;font-size:25px;line-height:27px;font-weight:bold;padding-bottom:2px;color:#005bab;">
                            National Center for Atmospheric Research
                          </div>

                          <font style="font-family:Arial, Helvetica, sans-serif;font-size:14px;line-height:21px;">


<strong>Saturday, October 25</strong><br />

<div style="float:right;padding: 5px 0px 5px 5px;"><a href="http://ncar.ucar.edu" target="_blank"><img src="http://kidspages.org/newsletter/images/2008-10-15/SuperScienceSaturday.jpg" width="175" height="117" border="0" alt="" /></a></div>
<br />

Saturday, October 25 is Super Science Saturday at the <a href="http://ncar.ucar.edu" target="_blank">National Center for Atmospheric Research</a>, a FREE event for students, teachers, and families and combines science education with Halloween fun. Participate in hands-on activity tables, take part in special science workshops, play Weather and Climate Jeopardy! Enjoy Face Fiesta Face Painting, Super Sticky Velcro Wall, Kid Powered Train Adventure, Rocky Mountain Segway, and more!<br />

                          </font>
                        </td>

                        <td bgcolor="#E2E5D2" height="100%" width="11"></td><td bgcolor="#9A9B96" height="100%" width="1"></td>
                      </tr>
                      <tr><td colspan="5" style="line-height:0px; font-size:0px;"><img height="12" src="http://kidspages.org/newsletter/images/2008-04-01/color001_bottom.jpg" width="381" alt="" /></td></tr>
                      <tr><td colspan="5" style="line-height:0px; font-size:0px;"><img height="14" src="http://kidspages.org/newsletter/images/2008-04-01/pix.gif" width="1" alt="" /></td></tr>
                    </table>
                  </td>
                </tr>
                <!-- /section 3 -->

                <!-- section 4 -->
                <tr>
                  <td align="left" bgcolor="#FFFFFF" height="100%">
                    <table border="0" cellpadding="0" cellspacing="0" height="100%" width="381">
                      <tr>
                        <td colspan="2" height="12" rowspan="2" style="line-height:0px; font-size:0px;" width="12"><img height="12" src="http://kidspages.org/newsletter/images/2008-04-01/color001_ul_corner.jpg" width="12" alt="" /></td>
                        <td bgcolor="#9A9B96" height="1px" style="line-height:0px; font-size:0px;" width="357"></td>
                        <td colspan="2" height="12" rowspan="2" style="line-height:0px; font-size:0px;" width="12"><img height="12" src="http://kidspages.org/newsletter/images/2008-04-01/color001_ur_corner.jpg" width="12" alt="" /></td>
                      </tr>
                      <tr><td bgcolor="#E2E5D2" height="11" style="line-height:0px; font-size:0px;"></td></tr>
                      <tr>
                        <td bgcolor="#9A9B96" height="100%" style="line-height:0px; font-size:0px;" width="1"></td><td bgcolor="#E2E5D2" height="100%" style="line-height:0px; font-size:0px;" width="11"></td>

                        <td align="left" bgcolor="#E2E5D2" height="100%" style="font-size: 12px; color:#343436; line-height:16px;" valign="top">
                          <div style="font-family:Arial, Helvetica, sans-serif;font-size:25px;line-height:27px;font-weight:bold;padding-bottom:2px;color:#005bab;">
                            Boo at the Zoo
                          </div>

                          <font style="font-family:Arial, Helvetica, sans-serif;font-size:14px;line-height:21px;">

<div style="float:right;padding: 5px 0px 5px 5px;"><a href="http://www.denverzoo.org" target="_blank"><img src="http://kidspages.org/newsletter/images/2008-10-15/booatthezoo.jpg" width="175" height="155" border="0" alt="" /></a></div>

<strong>Heroes of Planet Earth: Fly down to Denver Zoo on October 25 and 26 from 9am to 5pm</strong> for Denver Zoo’s 24th annual Boo at the Zoo. Kids are encouraged to dress up as their favorite superhero while they learn ways to save the environment.<br />
<br />
<div style="float:left;padding: 5px 5px 5px 0px;"><a href="http://www.denverzoo.org" target="_blank"><img src="http://kidspages.org/newsletter/images/2008-10-15/denverzoo.gif" width="100" height="123" border="0" alt="" /></a></div>
Denver Zoo will be the Secret Headquarters for young heroes of the planet. Kids will see how they can become Zooper Heroes for the planet, one environmentally-friendly act at a time while visiting more than 30 trick-or-treat stations and enjoying close encounters of the creepy kind, viewing vampire bats, reptiles, spiders and Denver Zoo’s other creatures.<br />
<br />
For more information and to purchase your tickets visit <a href="http://www.denverzoo.org" target="_blank">www.denverzoo.org</a><br />

                          </font>
                        </td>

                        <td bgcolor="#E2E5D2" height="100%" width="11"></td><td bgcolor="#9A9B96" height="100%" width="1"></td>
                      </tr>
                      <tr><td colspan="5" style="line-height:0px; font-size:0px;"><img height="12" src="http://kidspages.org/newsletter/images/2008-04-01/color001_bottom.jpg" width="381" alt="" /></td></tr>
                      <tr><td colspan="5" style="line-height:0px; font-size:0px;"><img height="14" src="http://kidspages.org/newsletter/images/2008-04-01/pix.gif" width="1" alt="" /></td></tr>
                    </table>
                  </td>
                </tr>
                <!-- /section 4 -->

              </table>
            </td>

            <td align="right" height="100%" valign="top">
              <table border="0" cellpadding="0" cellspacing="0" width="177">
                <tr>
                  <td colspan="5" style="line-height:0px; font-size:0px;"><img alt="Kids' Pages eBlast" src="http://kidspages.org/newsletter/images/2008-10-01/kphead.gif" width="177" height="59"></td>
                </tr>

                <tr>
                  <td bgcolor="#999999" height="100%" width="1"></td>
                  <td bgcolor="#E3EDB9" height="100%" width="11"></td>
                  <td align="center" bgcolor="#E3EDB9" height="100%" style="font-family:Arial, Helvetica, sans-serif;font-size:12px; color:#343436;padding-bottom:3px; line-height:16px;" valign="top" width="153">
                    <br />


                    <!-- Begin Sidbar Item -->
                    <div style="padding-right:0px;padding-top:0px;padding-bottom:10px;">
                      <a href="http://disney.go.com/disneylive/highschoolmusical" target="_blank"><img src="http://kidspages.org/newsletter/images/2008-10-15/highschoolmusical.jpg" width="150" height="132" border="0" alt="" /></a>
                    </div>
                    <div align="center" style="font-size:17px; line-height: 19px; font-weight:bold; color:#4e5670;">
                      <a href="http://disney.go.com/disneylive/highschoolmusical" target="_blank">Disney's<br />High School Musical</a>
                    </div>
                    <div style="text-align:center;line-height:150%;">

<p>The hottest phenomenon is now on ice! Disney's High School Musical: The Ice Tour is a live fusion of songs, dance, and team-spirited fun inspired by the smash hit Disney Channel Original Movie High School Musical and High School Musical 2. What time is it?! It's time to celebrate the sounds and the songs in this all-new ice show starring a cast of world-class skaters. Experience the wildcat frenzy and rock the house in Disney's High School Musical: The Ice Tour.</p>
<p>Playing the<br /><a href="http://www.ticketmaster.com/venueartist/246669/1105692" target="_blank">Broomfield Event Center</a> -- December 5-7<br />and the <a href="http://www.ticketmaster.com/event/1E0040A9ED2067D2?camefrom=CFC_FELD&brand=feldhighschoolmusical" target="_blank">Denver Coliseum</a> December 10-14</p>
<p><strong>Tickets available through <a href="http://www.ticketmaster.com/Disneys-High-School-Musical-The-Ice-Tour-tickets/artist/1105692?calendar_view=1&calendar_year=2008&calendar_month=12" target="_blank">Ticketmaster</a> or by calling: 303-830-TIXS</strong></p>
<br />

                    </div>
                    <br />
                    <!-- End Sidbar Item -->


                    <!-- Begin Sidbar Item -->
                    <div style="padding-right:0px;padding-top:0px;padding-bottom:10px;">
                      <a href="http://www.andbeyondtheatre.org" target="_blank"><img src="http://kidspages.org/newsletter/images/2008-10-15/vaudeville.jpg" width="150" height="257" border="0" alt="" /></a>
                    </div>
                    <div align="center" style="font-size:17px; line-height: 19px; font-weight:bold; color:#4e5670;">
                      Give My Regards to Vaudeville
                    </div>
                    <div style="text-align:center;line-height:150%;">
                      <p><strong>Saturday, November 1 at 8pm and Sunday, November 2 at 2pm</strong></p>
                      <p>And Beyond Theatre Company concludes its fourth season with Give My Regards to Vaudeville, a tribute to 1908 Vaudeville featuring Denver’s favorite ragtime pianist Hank Troy, a special appearance by the Suffering Suffragettes, and an audience sing-a-long.</p>
                      <p>Performances are at the Historic Grant Avenue Theatre, located in the Grant Avenue Community Center and Sacred Place, Denver.</p>
                      <p>Tickets are $15 for adults, $10 for children/seniors (65+) and purchased at the door. The Historic Grant Avenue Community Theatre is located at 216 South Grant Street, Denver<br />(SE corner of Cedar<br />and S. Grant).</p>
                      <p><strong>For tickets call<br />303-641-8796 or visit <a href="http://www.andbeyondtheatre.org" target="_blank">www.andbeyondtheatre.org</a></strong></p>
                    </div>
                    <!-- End Sidbar Item -->


                  </td>
                  <td bgcolor="#E3EDB9" height="100%" style="line-height:0px; font-size:0px;" width="11"></td>
                  <td bgcolor="#999999" height="100%" style="line-height:0px; font-size:0px;" width="1"></td>
                </tr>

                <tr>
                  <td colspan="5" style="padding: 0 0 14px 0; line-height:0px; font-size:0px;"><img border="0" height="12" src="http://kidspages.org/newsletter/images/2008-04-01/kpbook_bottom.jpg" width="177" alt="" /></td>
                </tr>

              </table>
            </td>
          </tr>

        </table>
      </td>
    </tr>
  </table>

  <table align="center" border="0" cellpadding="0" cellspacing="0" width="575">
    <tr>
      <td align="left" valign="top" width="100%">

      <p style="font-size:9px;">
      <font color="#000000" face="Verdana, Arial, Helvetica, sans-serif" size="1" style="font-size: 9px; font-family: Verdana, Arial, Helvetica, sans-serif;">
        Don't see the images in this e-mail? Please add eblast@KidsPages.org to<br /> your address book or safe senders list.<br />
        <br />
        You are receiving these bimonthly eBlasts because of your relationship with KidsPages.org.<br />
        We will never share our mailing list with anyone. If you do not wish to continue<br />
        receiving these announcements, please click <a href="http://kidspages.org/unsubscribe/$email_address">here</a> to unsubscribe.<br />
        <br />
        &copy; Copyright 2008 Kids Pages Family Media, Inc.
      </font>
      </p>

      </td>
    </tr>
  </table>
</body>
</html>


EOT;

// Plain text body (for mail clients that cannot read HTML)
$text_body  =
<<<EOT

Happy Fall!
Tradition, Family and Fun...full-speed ahead!

Kids' Pages Family -- Interactive Online Community for Parents -- October Issue

Informing, Entertaining and Educating Families in Metro Denver, Boulder and Northern Colorado.

Enjoy the Most Comprehensive Family Calendar with hundreds of free and low-cost events. Interesting, Informative Articles, Exciting Contests, Money-Saving Coupons, Forums, Reviews, Blogs and so much more!

Go to KidsPages.org and visit your Family Resource!

EOT;

  $mail->From     = "eBlast@kidspages.org";
  $mail->FromName = "Kids' Pages Family";
  $mail->Mailer   = "mail";

  $mail->Body    = $body;
  $mail->AltBody = $text_body;
  $mail->Subject = "October Events for Family Fun";
  $mail->AddAddress( $email_address );


//    echo "NOT sending $count / $numrows to " . $email_address . "<br>";
//    $insertsql = "INSERT INTO `kp_ebook_sent` (`email`) VALUES ( '$email_address' )";
//    $insert_success = MYSQL_QUERY( $insertsql );
//    echo "insert was" . ( $insert_success ? " very" : " NOT" ) . " successful<br /><br />";
    

  if ( !$mail->Send() )
  {
    echo "$count / $numrows : There has been a mail error sending to " . $email_address . "<br>";
  }
  else
  {
    echo "$count / $numrows : Success sending to " . $email_address . "<br>";

    $insertsql = "INSERT INTO `kp_ebook_sent` (`email`) VALUES ( '$email_address' )";
    @MYSQL_QUERY( $insertsql );
  }

  // Clear all addresses and attachments for next loop
  $mail->ClearAddresses();
  $mail->ClearAttachments();
}

  echo "<br />";
  echo "### COMPLETE ###<br />";
  echo '### End: ' . date('l jS \of F Y h:i:s A') . "<br />";
?>
