Jump to content

why oh why... not working..!


shaunbaird

Recommended Posts

Really struggling with this darned script, it SHOULD work fine - al connects fine, and acts like it has sent an email, but.. nothing.. just nothing happens after i hit the submit button,

 

help!

 

<?

include('../header.php');
include('../config.php');

if(isset($submit))
{
if(empty($who))
{
echo "<center><br><br><br> You did not choose the emails recipient.<br> Go <a class=TN href=mail.php> back </a> and make your choice. </center>";
exit;
}
if(empty($message))
{
echo "<center><br><br><br> SILLY BILLY!  You are trying to send a blank email. <br> Go <a class=TN href=mail.php> back </a> and write some text. </center>";
exit;
}
     if($_POST['who'] == 'tb_users')
     {
$q1 = "select email from tb_users";
$r1 = mysql_query($q1) or die(mysql_error());
     }
     elseif($_POST['who'] == 'advertisers')
     {
$q1 = "select email from newl ";
$r1 = mysql_query($q1) or die(mysql_error());
     }
while($a1 = mysql_fetch_array($r1))
{

$get_general = mysql_query("SELECT * FROM main");
                $grow = mysql_fetch_array($get_general);
        $g_title = $grow[title];
        $g_baseurl = $grow[baseurl];
        $g_aemail = $grow[adminemail];
	$g_newsemail = $grow[newsemail];

	$mailheaders = "From: " .$g_newsemail. "\r\n";
	$mailheaders .= "Reply-To: " .$g_newsemail. "\r\n"; 
	$mailheaders .= "Content-Type: text/plain; charset=\"ISO-8859-1\"\r\n";
	mail($a1[0], $subject, $message, $mailheaders);
}
echo "<center><br><br><br>The mail was sent successfully. </center>";
unset($who);
exit;
}
?> 
<div align="center"><br>
  <strong><font size="2" face="Arial, Helvetica, sans-serif">Email Members</font></strong><br>
</div>
<FORM ACTION=<?=$_SERVER['PHP_SELF']?> METHOD=POST> 
  <table align=center width=550>
    <tr> 
      <td><font size="2" face="Arial, Helvetica, sans-serif"> Send emails to all: 
        </font></td>
      <td> <select name=who>
          <option value="">Select </option>
          <option value="tb_users">Members </option>
         
        </select> </td>
    </tr>
    <tr> 
      <td><font size="2" face="Arial, Helvetica, sans-serif">Subject: </font></td>
      <td><input type=text name=subject></td>
    </tr>
    <tr> 
      <td valign=top><font size="2" face="Arial, Helvetica, sans-serif">Message: 
        </font></td>
      <td><textarea rows=6 cols=45 name=message></textarea></td>
    </tr>
    <tr> 
      <td colspan=2 align=center> <input type=submit name=submit value=Send> </td>
    </tr>
  </table>
</form>

 

Link to comment
https://forums.phpfreaks.com/topic/107065-why-oh-why-not-working/
Share on other sites

http://email.about.com/cs/phpemailtips/qt/et031202.htm explains the mail paths. You'll want to make sure that you are sending the mail using a valid smtp/sendmail facility etc. Check the articles on local/remote hosting (dependent on which one you use). I hope this helps!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.