TecTao Posted June 1, 2009 Share Posted June 1, 2009 I am trying to finish up an application where when a member of one member group clicks on a form submit button, the refresh page inserts the info into a DB but also sends out a mass email to members of a second group notifying them of the new project. I am using a mass email script I've edited down. It calls a separate PHP page which contains the email message. Currently no querry from the DB to include project info. The second part of the script calls a PHP page that would contain the email addresses. When they emails addresses are hard coded, the mass email works fine. When I change the page to a sql query with an echo for the email addresses, that page displays the emails from the DB but no emails are sent. Below is the code that sends out the emails. The config.php include shows the path to both the Message.php and Adress.php files. To view the results of of the email query, here's the page http://sourceandquote.com/mail/Address.php <?php include "config.php"; // **************************read message into array********************************** $handle = fopen($mailfiles."Message.php", "r"); $message = ""; if ($handle) { while (!feof($handle)) { $buffer = fgets($handle, 4096); $message.= $buffer; //echo $buffer; } fclose($handle); } $handle = fopen($mailfiles."Address.php", "rt"); if ($handle) { while (!feof($handle)) { $to = fgets($handle, 4096); //echo $to; $headers = "MIME-Version: 1.0"."\n"; $headers.= "Content-type: text/html; charset=iso-8859-1"."\n"; $headers.= "From: ".$from." <[email protected]>"."\r\n"; if (mail($to, $subject, $message, $headers)){ //**write email address into sent file $action = date("Y/m/d,".(date('H')).":i:s", mktime()) . ",".$to."\n"; $fd = fopen($mailfiles."Sent.txt", "a"); fwrite($fd, $action); fclose($fd); } } fclose($handle); } return(0); print "Error"; ?> Link to comment https://forums.phpfreaks.com/topic/160521-solved-mass-email-doesnt-work-with-either-db-query-or-calling-a-page-that-queries/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.