Take a look in the manual, it explains it pretty clearly. In the future I recommend the manual and google before posting questions.

    I agree with Piranha. But to get you on the right track, here is one I use.

    //open the port
    $fp = fsockopen(localhost, 25, $errno, $errstr, 30);
    
    $email_dbname = "database_name";
    mysql_select_db ($email_dbname, $conn) or die (mysql_error());
    //Select users and send emails one at a time
    $query = "SELECT EmailAddress, FirstName, LastName FROM email_list WHERE requested='1'";
    $getrow = mysql_query($query, $conn) or die(mysql_error());
    	while($row = mysql_fetch_array($getrow)) {
    		$EmailAddress = $row['EmailAddress'];
    		$FirstName = $row['FirstName'];
    		$LastName = $row['LastName'];
    		echo 'Sending emails to -->'.$FirstName.' '.$LastName.' '.'at '.$EmailAddress.'<br>';
    
    	//Send email to them
    		$message = '<html><head></head><body>All your HTML info goes here!</body></html>';
    
    		$header = 'MIME-Version: 1.0' . "\r\n";
    		$header .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
    		$header .= "From: admin@whereever.com\r\n";
    		$subject = $emails_subject;
    		$email_to = $EmailAddress;
    		mail($email_to, $subject ,$message ,$header) ;
    		}
    fclose($fp); // close fp port
    echo '<br>All the "emails have been sent!!!';
    

    That will do it, of course, after you change the vanilla table info to your table info.

    Good luck,

    Don

      Write a Reply...