darrenwindle Posted June 5, 2012 Share Posted June 5, 2012 Hi, Im trying to implement my own php mailinglist script. The list works and i am able to get the list to show on the specified age. however when i try to send a message to the recipients it processes the send.php script but I dont get nothing. (It doesnt send to any email adresses selected. This script was taken from a tutorial on YouTube. My hosting provider is Justhost. the index.php (The page that displays the contents of the sql database that has agreed to be mailed with updates.) <?php session_start(); $page_title = 'Administration'; if (!isset($_SESSION['loggedin'])) { header("Location: ../../login.php"); } include("includes/headerOut.php"); include('includes/nav.php'); ?> <div id="primaryContent"> <?php include('includes/login.php'); ?> <br /> <hr /> <h4>This section is for system administrators only</h4> <h4>If you have arrived here please follow this link to return to the main PinkDate website</h4> <form action="../../index.php"> <input type="image" class="btn_sm_left" value="submit" src="../images/sbumitBtn.jpg" /> </form> </div> <div id="mainContent"> <p> </p> <p><a href="../index.php"><img src="../images/home.jpg" width="41" height="40" border="0"></a></p> <p><a href="../index.php">Home</a></p> <p> <?php require('db/pddb.php'); echo "<h1>Mailing List</h1>Send To<p>"; //setup variables $mailcount = 0; $namecount = 0; $get = mysql_query("SELECT * FROM pd_customers WHERE cust_news='1'"); echo "<form action='send.php' method='GET'>"; while($getrow = mysql_fetch_assoc($get)) { echo "<input type='checkbox' name='mail_".$mailcount++."' value='".$getrow['cust_email']."' CHECKED>".$getrow['cust_first_names']." ".$getrow['cust_last_name']."(".$getrow['cust_email'].") <input type='hidden' name='name_".$namecount++."' value='".$getrow['cust_first_names']."'> <br>"; } echo "<p> Message:<br> <textarea name='message'></textarea><p> <input type='submit' name='submit' value='Send'> </form>"; ?> </div> <?php include('includes/footer.php'); ?> </div> </div> </div> </div> </div> </body> </html> The send.php (The script that processes the reponse from the mailing list form) <?php require('db/pddb.php'); //Change php.ini smtp line ini_set("SMTP", "xxdomain.mailserver.com" //standard mail header $headers = "From: [email protected]"; //Get Message to send $message = $_GET['message']; //Loop through for($x=0;$x<count($_GET);$x++) { if($_GET['mail_$x']) { //mailsetup $to + $_GET["mail_$x"]; $subject = "Newsletter"; $body = "Dear ".$_GET["name_$x"]." \n\n $message \n\n More Text Here "; mail($to, $subject, $body, $headers); } } echo "All Mail has been processed"; ?> Link to comment https://forums.phpfreaks.com/topic/263718-php-mailing-list/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.