Jump to content

Not Emailing


topflight

Recommended Posts

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

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

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.