View Single Post
Old 02-18-2003, 10:34 AM   #4 (permalink)
noppie
Registered User
 
noppie's Avatar
 
Join Date: Feb 2003
Posts: 2
noppie is on a distinguished road
Send a message via Yahoo to noppie
this is an actual database-- I designed.
we a peace group and will have a large mailing list..

We can add the information into the database great.

now we need to access the database to beable to email the people in the database.

I got this program below==
it works great--but the problem is not everyoone can read code.. I have a little understanding.

so what i want is anyone in the group to be-able to send an email using the email address in the datatbase. and htmp page would be nice.. I am just stumpted on how to do it.. to convert the code to be user friendly.
help

PHP Code:
<?php
//////////////////////////////////////////////////////////////////////////////

//                                                                          //

//                   Jason's Mass Mailer v1.2                               //

//                                                                          //

//               [[url]http://www.rottmansales.com/jason/[/url]]                       //                          

//////////////////////////////////////////////////////////////////////////////

//                  Configure the following variables                       //

//////////////////////////////////////////////////////////////////////////////

$host "localhost";                //Host
$user "root";                         //Username
$pass "";                         //Password
$database "Mailing_list_for_FORCE";                     //Database name
$table "Name_info";                        //Name of table that has list of emails
$column "Email";                       //Name of column in table that has list of emails
$num_per_loop "5";                //Number of emails sent per page loop (keep number low to avoid page time-out)
$from_name "rainbowstop@attbi.com)"//Reply address email address
$from_email "rainbowstp@attbi.com";                   //Name the emails came from
$mail_subject "Testing email on for email list--just disregard";
$mail_body "This is the test";
$send_html_messages "yes";        //yes - Send html messages,  no - Do not send html messages

//////////////////////////////////////////////////////////////////////////////

//               DO NOT CHANGE ANYTHING BELOW THIS LINE                     //

//////////////////////////////////////////////////////////////////////////////





if (($first_time == "yes") || ($first_time == "")) {

$total_sent "0";
$total_time "0";


$start "0";

$num_to_end $num_per_loop;

}

if (
$first_time == "no") {

$start $start;

$num_to_end $num_per_loop;

}



$mydb mysql_connect($host,$user,$pass);
if (!
$mydb) { echo "Error connecting to database"; die; }

mysql_select_db($database);



$varx $start $num_to_end 1;

$result2 mysql_query("SELECT " $column " FROM " $table " LIMIT " $start ", " $varx "") or die(mysql_error());

$num_left "0";

$clock_start number_format(microtime(),3);

while(list(
$email_addr) = mysql_fetch_row($result2)) {

    
$num_left $num_left 1;

}

$result3 mysql_query("SELECT " $column " FROM " $table " LIMIT " $start ", " $num_to_end "") or die(mysql_error());

while (list(
$column) = mysql_fetch_row($result3)) {



    
$xheaders "From: " $from_name " <" $from_email ">\n";

    
$xheaders .= "X-Sender: <" $from_email ">\n"

    
$xheaders .= "X-Mailer: PHP\n"// mailer

    
$xheaders .= "X-Priority: 6\n"// Urgent message!

    
if ($send_html_messages == "yes") {

        
$xheaders .= "Content-Type: text/html; charset=iso-8859-1\n"// Mime type

    
}

    
mail("$column",

    
"$mail_subject",

    
"$mail_body",

    
$xheaders);

    
$total_sent $total_sent 1;

}

$clock_stop number_format(microtime(),3);

$clock_difference $clock_stop $clock_start;

$total_time $total_time $clock_difference;

mysql_close();





if (
$num_left $num_per_loop) {

    
$next_start $start $num_per_loop;

    
//echo "<a href=\"" . $PHP_SELF . "?first_time=no&start=" . $next_start . "&total_sent=" . $total_sent . "&total_time=" . $total_time . "\">Next " . $num_per_loop . "</a>\n";

    
header("Location: " $PHP_SELF "?first_time=no&start=" $next_start "&total_sent=" $total_sent "&total_time=" $total_time "");

}

if (
$num_left <= $num_per_loop) {

    echo 
"FINISHED<br><br>";

    echo 
"Total Emails Sent: " $total_sent "<br>\n";

    echo 
"Total Script Run Time Used: " $total_time " seconds<br>\n";
    echo 
"<a href=\"" $PHP_SELF "\">Run Again</a><br><br><br>\n";
    echo 
"Provided By: <a href=\"http://www.rottmansales.com/jason/\">[url]http://www.rottmansales.com/jason/[/url]</a><br>\n";

    
end;

}



?>
:rock:
noppie is offline   Reply With Quote