topflight Posted August 14, 2009 Share Posted August 14, 2009 This script edits the database and do all the fancy stuff, but it doesn't shoot the email please help. <?php $prid = $_POST['dprid']; $plogin = $_POST['dlogin']; if(isset($_POST["submit"])){ $now = date("m.d.y"); $ip = $_SERVER['REMOTE_ADDR']; $preason = $_POST['preason']; $dreason = $_POST['dreason']; $process = $_POST['process']; $update = mysql_query("UPDATE pireps SET status ='2', process='$process' WHERE prid = '$prid'") or die("MySQL Said:".mysql_error()); $comment = "$dreason process by $process"; $insert = mysql_query("INSERT INTO `pirep_history` (process,comment,date,ip) VALUES ('$process','$comment','$now','$ip')") or die(mysql_error()); $pilot = mysql_query("SELECT * FROM `members` WHERE login='$plogin'") or die("MySQL Said:".mysql_error()); $prow = mysql_fetch_assoc($pilot); $pemail = $prow["email"]; $pfname = $prow["fname"]; $plname = $prow["lname"]; $to = "$pemail"; $subject = "Pirep Accepted "; $message = " Dear $pfname $plname, Your pirep with the ID of $prid has been rejected for the following reason: $preason $from = "[email protected]"; $headers = "From: $from"; mail($to, $subject, $message, $headers); echo'Pirep Rejected Sucessfully'; ?> Link to comment https://forums.phpfreaks.com/topic/170206-not-emailing/ Share on other sites More sharing options...
kenrbnsn Posted August 14, 2009 Share Posted August 14, 2009 If the code you posted is an exact copy of your code, then you're missing the terminating quote here: <?php $message = " Dear $pfname $plname, Your pirep with the ID of $prid has been rejected for the following reason: $preason ?> Ken Link to comment https://forums.phpfreaks.com/topic/170206-not-emailing/#findComment-897873 Share on other sites More sharing options...
topflight Posted August 14, 2009 Author Share Posted August 14, 2009 Well on my code I have the termination quotes. and it still wont work. Link to comment https://forums.phpfreaks.com/topic/170206-not-emailing/#findComment-897875 Share on other sites More sharing options...
topflight Posted August 14, 2009 Author Share Posted August 14, 2009 any other help please Link to comment https://forums.phpfreaks.com/topic/170206-not-emailing/#findComment-898437 Share on other sites More sharing options...
mikesta707 Posted August 14, 2009 Share Posted August 14, 2009 besides the failed termination of the string in your script, everythign else seems fine Link to comment https://forums.phpfreaks.com/topic/170206-not-emailing/#findComment-898441 Share on other sites More sharing options...
topflight Posted August 15, 2009 Author Share Posted August 15, 2009 well I just don't know why it is not emailing Link to comment https://forums.phpfreaks.com/topic/170206-not-emailing/#findComment-898576 Share on other sites More sharing options...
redarrow Posted August 15, 2009 Share Posted August 15, 2009 If going to use the php mail function in that way, then use it correctly. http://www.w3schools.com/PHP/php_mail.asp read about headers mate! Link to comment https://forums.phpfreaks.com/topic/170206-not-emailing/#findComment-898605 Share on other sites More sharing options...
redarrow Posted August 15, 2009 Share Posted August 15, 2009 I guess the date of $now is wrong format to enter the info not sure theo? <?php $prid = $_POST['dprid']; $plogin = $_POST['dlogin']; if(isset($_POST['submit'])){ $now = date("m.d.y"); $ip = $_SERVER['REMOTE_ADDR']; $preason = $_POST['preason']; $dreason = $_POST['dreason']; $process = $_POST['process']; $update = mysql_query("UPDATE pireps SET status ='2', process='$process' WHERE prid = '$prid'") or die("MySQL Said:".mysql_error()); $comment = "$dreason process by $process"; $insert = mysql_query("INSERT INTO `pirep_history` (process,comment,date,ip) VALUES ('$process','$comment','$now','$ip')") or die(mysql_error()); $pilot = mysql_query("SELECT * FROM `members` WHERE login='$plogin'") or die("MySQL Said:".mysql_error()); $prow = mysql_fetch_assoc($pilot); $pemail = $prow['email']; $pfname = $prow['fname']; $plname = $prow['lname']; $to = "$pemail"; $subject = "Pirep Accepted "; $message = " Dear $pfname $plname, Your pirep with the ID of $prid has been rejected for the following reason: $preason"; $from = "[email protected]"; $headers = "From: $from"; mail($to, $subject, $message, $headers); echo "Pirep Rejected Sucessfully"; } ?> Link to comment https://forums.phpfreaks.com/topic/170206-not-emailing/#findComment-898609 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.