this mail system is working in my local domain(S.K@ r.j.com).i want to send mail to S.K@ j.com. please help me to how to configure mail system .

<?php 
$con = mysql_connect("localhost","root",""); 
if (!$con) 
  { 
  die('Could not connect: ' . mysql_error()); 
  } 

mysql_select_db("users", $con); 

$sql="INSERT INTO entryform (Name,Department, Problem, Ext_no, Ip_Add, Remark, Email ,status) 
VALUES ('$_POST[Name]','$_POST[Department]','$_POST[Problem]','$_POST[Ext_no]','$_POST[Ip_Add]','$_POST[Remark]','$_POST[Email]','$_POST[status]')"; 

if (!mysql_query($sql,$con)) 
  { 
  die('Error: ' . mysql_error()); 
  } 
  echo ""; 


mysql_close($con); 




$to = "S.K@r.j.com"; 

$subject = $_POST['Problem'];
$message = " Dear Sir,
                        Your Complaint Deatils is :--



  Name: " . $_POST['Name'] . " 

 Department: " . $_POST['Department']. " 

 Problem:".$_POST['Problem'] . "

 Ext no. : " . $_POST['Ext_no'] ."

 IP Add: " . $_POST['Ip_Add'] . "

 Remark: " . $_POST['Remark'] . "

 Email: " . $_POST['Email'] . "

 status: " . $_POST['status'] ;

 $message.=


 " 



 Thank you



 Regards,
Helpdesk 

 ";


$sent = mail($to,$subject, $message  ) ;  

if($sent)  
{print "  "; } 
else  
{print "We encountered an error sending your mail"; } 

?>

<?php require_once('../Connections/Helpdesk.php'); ?>

<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
  $updateSQL = sprintf("UPDATE entryform SET Name=%s, Department=%s, Problem=%s, Ext_no=%s, Ip_Add=%s, Remark=%s, Email=%s, status=%s WHERE id=%s",
                       GetSQLValueString($_POST['Name'], "text"),
                       GetSQLValueString($_POST['Department'], "text"),
                       GetSQLValueString($_POST['Problem'], "text"),
                       GetSQLValueString($_POST['Ext_no'], "double"),
                       GetSQLValueString($_POST['Ip_Add'], "text"),
                       GetSQLValueString($_POST['Remark'], "text"),
                       GetSQLValueString($_POST['Email'], "text"),
                       GetSQLValueString($_POST['status'], "text"),
                       GetSQLValueString($_POST['id'], "int"));

  mysql_select_db($database_Helpdesk, $Helpdesk);
  $Result1 = mysql_query($updateSQL, $Helpdesk) or die(mysql_error());

  $updateGoTo = "../Home.aspx";
  if (isset($_SERVER['QUERY_STRING'])) {
    $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
    $updateGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $updateGoTo));
}

mysql_select_db($database_Helpdesk, $Helpdesk);
$query_edit = "SELECT * FROM entryform";
$edit = mysql_query($query_edit, $Helpdesk) or die(mysql_error());
$row_edit = mysql_fetch_assoc($edit);
$totalRows_edit = mysql_num_rows($edit);
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
a:link {
    text-decoration: none;
}
a:visited {
    text-decoration: none;
}
a:hover {
    text-decoration: none;
}
a:active {
    text-decoration: none;
}
-->
</style></head>

<body>

<p align="left"><table width="100%" border="0" cellspacing="0" cellpadding="4">
  <tr align="center">
    <td><img src="../Images/header-bg.jpg" alt="LOGO" width="998" height="112" /></td>
  </tr>
  <tr>
    <td align="center"><a href="#"></a><a href="#"></a><a href="#"></a></td>
  </tr>
</table>
</p>
<div align="center">
  <table width="473" border="0">
    <tr>
      <td></td>
    </tr>
  </table>
</div>
<p>&nbsp;</p>
<p>.
  .

  </div></p>
<p align="center">Thank you for submitting data</p>
<p align="center">&nbsp;</p>
<p>&nbsp; </p>
<p align="center"><a href="../Home.aspx">Exit</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><div align="center">
  <table width="1011" height="61" border="0" cellpadding="2" cellspacing="0" bgcolor="#CCCCCC">
    <tr>
      <td valign="top" bgcolor="#24396E"><div align="center">:
        </div>
      <div align="right"><span class="style6"><font color="#FFFFFF">Developed By :-Navratan Vaishnaw (I.T. Department)</font></span> </div></td>
    </tr>
  </table>
  </p>
</div></p>

</body>
</html>
<?php
mysql_free_result($edit);
?>

Will you please share what the problem was and how you resolved it, to help out others ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.