Hi All
I need help with a few things here , I have a simple helpdesk where users send thier trouble ticket, it gets assigned and then when the user is happy he/she can close the query if not reopen it
the reopening of the query works fine and the email get sent to the user
this script userclosed.php has two mail function one is closing and one is for reopening , the function of closing works but the email is not sent to the user
when i click submit on the closing query it shows the blank screen and it does not return to the queryclosed.php
pls help maybe i did something wrong
<?php
include("connection.php");
require("class.phpmailer.php");
require("class.smtp.php");
// Check if tech is not set
//send email to user if tech marks closed
$date=mktime(date(H),date(i),date(s),date(m),date(d),date(Y));
if ($_POST[status]==0)
{
$sql="update resolved set user_comment='$_POST[user_comment]', date_closed=$date ";
$sql.="where ticket_query=$_POST[ticket]";
mysql_query($sql);
$sql="update query set status=$_POST[status] ";
$sql.="where ticket=$_POST[ticket]";
mysql_query($sql);
}
else
{
$sql="update resolved set user_comment='$_POST[user_comment]' where ticket_query=$_POST[ticket]";
mysql_query($sql);
echo mysql_error();
$sql="update query set status=$_POST[status] ";
$sql.="where ticket=$_POST[ticket]";
mysql_query($sql);
// E-mail function";
$to="$_POST[techemail]\r\n";
$msg="Hi<br><br> Check....Thank you for re-opening your query.Your problem is being reviewed by our Technicians and it has our full attention.\r\n\n Your Ticket no. is <a href=http://localhost/test/IT/help/view.php?ticket=$_POST[ticket]> $_POST[ticket]</a>\r\n<br><br>";
$msg.="Re-opened with user comment:\r\n";
$msg.="$_POST[user_comment]\r\n<br><br>Regards.\r\n\n<br>Thikho IT Helpdesk.\r\n\n";
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = "10.0.0.3";
$mail->FromName = "Thikho IT Helpdesk";
$mail->Sender = "\"Thikho IT Helpdesk\" ";
$mail->IsHTML(true);
$mail->From = "From: $_POST[useremail]\r\n";
$mail->AddAddress($to);
$mail->Subject = "Re-open query - Ticket no. $_POST[ticket]\r\n";
$mail->Body = $msg;
if ($_POST[category] == 'Freightware' || $_POST[category] == 'Freightware Printer'){
$mail->AddAddress("test1@webmail.co.za");
} else {
$mail->AddAddress("test2@webmail.co.za");
}
//$mail->Send and error checking
if(!$mail->Send()) // Now we send the email and check if it was send or not.
{
echo 'Message was not sent.';
echo 'Mailer error: ' . $mail->ErrorInfo;
}
else
{
header("location: queryclosed.php?message=sent");
echo 'Message has been sent.';
}
echo mysql_error();
}
if ($_POST[status]==1)
{
//Get info on technician
$sql="select * from tech where tech_id=$_POST[tech]";
$get=mysql_query($sql);
$result=mysql_fetch_array($get);
// E-mail function
$tic=$_POST[ticket]*1024;
$to="$_POST[useremail]\r\n";
$msg="Hi<br><br>\r\n\nCheck.....Your Query have been successfully closed.Thank you for your co-operation.\r\n\n";
$msg.="<br>$_POST[tech_comment]<br><br>Regards,\r\n\n<br>Thikho IT Helpdesk.\r\n\n";
$mail1 = new PHPMailer();
$mail1->IsSMTP();
$mail1->Host = "10.0.0.3";
$mail1->FromName = "Thikho IT Helpdesk";
$mail1->Sender = "\"Thikho IT Helpdesk\" ";
$mail1->IsHTML(true);
$mail1->From = "From: $_POST[useremail]\r\n";
$mail1->AddAddress($to);
$mail1->Subject = "Update of query - Ticket no. $_POST[ticket]";
$mail1->Body = $msg;
if ($_POST[category] == 'Freightware' || $_POST[category] == 'Freightware Printer'){
$mail->AddAddress("test1@webmail.co.za");
}
if(!$mail1->Send()) // Now we send the email and check if it was send or not.
{
echo 'Message was not sent.';
echo 'Mailer error: ' . $mail1->ErrorInfo;
}
else
{
header("location: queryclosed.php?message=sent");
echo 'Message has been sent.';
}
echo mysql_error();
}
?>