DasHaas Posted January 22, 2008 Share Posted January 22, 2008 Hello all, I have a mail script that I am currently using and for the most part it seems to work well. In a nutshell it grabs the email addys from a MYSQL table and emails all the recipients...so I thought. My two personal emails are in the table (gmail & bellsouth.net) I get the emails with my gmail account but nothing in my bellsouth.net account. I looked in the spam folder and nothing. I wonder how many people in my table are not getting my emails? Can anyone help shed some light on this as well as some pointers to optimize my script. here is my script, I omitted the connection for its not really necessary. <?php // includes include('includes/PXS_Conf.php'); // open database connection $connection = mysql_connect($host, $user, $pass) or die ('Unable to connect to MySql server!'); // select database mysql_select_db($db) or die ('Unable to select database!'); $sql_state = mysql_query("SELECT state FROM PXS_Newsletter WHERE verified = 1 GROUP BY state") or die (mysql_error()); $sql_gender = mysql_query("SELECT gender FROM PXS_Newsletter WHERE verified = 1 GROUP BY gender") or die (mysql_error()); // form not yet submitted // display initial form if (!$_POST['submit']) { ?> <table cellpadding="5" cellspacing="5" class="table1"> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST"> <tr> <tr> <td valign="top" class="text5">Subject</td> <td><input name="txtsubject" type="text" class="table2" id="txtsubject" size="50" maxlength="250"></td> </tr> <tr> <td valign="top" class="text5">Email Body</td> <td valign="top" class="text5"><textarea name="txtbody" cols="47" rows="10" class="table2" id="txtbody"></textarea></td> </tr> <tr> <td colspan="2" valign="top" class="text5"><input name="submit" type="submit" id="submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"></td> </tr> </form> </table> <?php } else { // set up error list array $errorList = array(); $msgsubject = $_POST['txtsubject']; $msgbody = $_POST['txtbody']; $state = trim($_POST['ssl_state']); $gender = trim($_POST['ssl_gender']); // validate text input fields if (trim($_POST['txtsubject']) == '') {$errorList[] = 'Invalid entry: Message Subject';} if (trim($_POST['txtbody']) == '') {$errorList[] = "Invalid entry: Message Body";} // check for errors // if none found... if (sizeof($errorList) == 0) { // generate and execute query $query = mysql_query("SELECT email FROM PXS_Newsletter WHERE verified = 1") or die (mysql_error()); while($row = mysql_fetch_row($query)){ $email = $row[0]; // send email $headers = "Reply-To:".$fromname."<".$fromaddress.">".$eol; mail($email, $msgsubject, $msgbody, $headers);} // print result echo '<center><span class="text6">Message sent!</span></center>'; // close database connection mysql_close($connection); } else { // errors found // print as list echo 'The following errors were encountered:'; echo '<br>'; echo '<ul>'; for ($x=0; $x<sizeof($errorList); $x++) { echo "<li>$errorList[$x]"; } echo '</ul>'; } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/87248-mail-script-tweaking/ Share on other sites More sharing options...
paul2463 Posted January 22, 2008 Share Posted January 22, 2008 //in this line where are the variables set?? $headers = "Reply-To:".$fromname."<".$fromaddress.">".$eol; Quote Link to comment https://forums.phpfreaks.com/topic/87248-mail-script-tweaking/#findComment-446367 Share on other sites More sharing options...
DasHaas Posted January 22, 2008 Author Share Posted January 22, 2008 those variables are set in the include file, sorry I forgot to note that Quote Link to comment https://forums.phpfreaks.com/topic/87248-mail-script-tweaking/#findComment-446370 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.