echocpt Posted September 10, 2008 Share Posted September 10, 2008 Hi, im trying to create a emailing script where a user can choose peoples emails by a group name. At the moment im stuck as the code im running just stops at a blank page. Iv even tryed adding error_reporting(E_ALL); ini_set('display_errors', '1'); error code to the page, but it still turns blank and does not send the email, could anyone look at the code and help out maybe? Thanks. HTML Code. <?php $query = "SELECT DISTINCT `email`, `group` FROM `email`"; $result = mysql_query($query) or die(); ?> <?php if ($_GET['email']==true) { ?> <div class="msg_body"> <p class="msg_head2">Email Users></p> <form id="form5" name="form5" method="post" action="email.php"> <table width="638" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="190" height="28" valign="top"><p><strong>Add User:</strong></p> </td> <td width="449"><label></label></td> </tr> <tr> <td height="30">To:</td> <td><label> <select name="emailgroup"> <?php while($row = mysql_fetch_assoc($result)) { echo "<option value=''" . $row['email'] . "'>" . $row['group'] . "</option>"; } ?> </select> </label></td> </tr> <tr> <td height="30">Subject:</td> <td><label> <input name="subject" type="text" class="area" id="subject" /> </label></td> </tr> <tr> <td height="30">Content:</td> <td><label> <textarea name="emailcontent" id="emailcontent" class="box" cols="50" rows="8"></textarea> </label></td> </tr> <tr> <td height="30"> </td> <td><label></label> <label></label></td> </tr> <tr> <td height="30"> </td> <td><label></label></td> </tr> <tr> <td> </td> <td><input type="submit" name="submit" id="submit" value="Send Email" /></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> </tr> </table> </form> <br /> <br /> <br /> </div> <?php } ?> php code: <?php include("connection.php"); if(isset($_POST['submit'])) { $group = $_POST['emailgroup']; $query = "SELECT 'email' FROM `email` WHERE group=\"" . $group . "\""; $result = mysql_query($query) or die(); $row = mysql_fetch_object($result); $emailusers = array (email); $Name = "Woodbridge School CCF"; //senders name $email = "delt_cpt@hotmail.com"; //senders e-mail adress $message = $_POST['emailcontent'] ; $subject = $_POST['subject'] ; mail($emailusers, $subject, $message, "From: $email"); echo "Email Sent"; } else { header('admin.php?email=true'); } ?> Quote Link to comment 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.