<? 
include("../includes/site_config.php");

$mail1=mysql_query("SELECT mem_email, mem_username from members where mem_userid='".$_REQUEST['mail_mem']."'");
$mail=mysql_fetch_object($mail1);

if(isset($_REQUEST['mail'])){
include_once __INCLUDE_CLASS_PATH."/class.ItemManager.php";
$option_manager = new OptionManager();
$from=$option_manager->GetValue('mail');
$to=$mail->mem_email;
$mail;
//$to='ashish.shukla@midlandwebnet.com';
$subject=$_REQUEST['subject'];		
$message=$_REQUEST['message'];
$headers = "MIME-Version: 1.0\n"; 
$headers .= "Content-type: text/html; charset=iso-8859-1\n"; 
$headers .= "X-Priority: 3\n"; 
$headers .= "X-MSmail-Priority: Normal\n"; 
$headers .= "X-mailer: php\n"; 
$headers .= "From: $from"; 

$mail_sent=mail($to,$subject,$message,$headers);
$response="Mail Sent to $mail->mem_username";
}


if($response) {?>
<DIV align=center>

						
						<font color="#094E89"><b><?=$response?><b></font>
<HR width="70%" color=#094E89 SIZE=0>
<BR>
</DIV>
<DIV align=center><A href="javascript: self.close ()">Close this Window</A></DIV>
<? } else {?>

<link href="<?=$CONST_LINK_ROOT?>/templates/default/stylesheet.css" rel="stylesheet" type="text/css" />
<link href="<?=$CONST_LINK_ROOT?>/templates/default/layout.css" rel="stylesheet" type="text/css" />  
<div class="mainwidth">
<div class="admin-page-header"><div class="admin-page-heading">&nbsp;&nbsp;Email Member</div></div>
<div class="clear"></div>
<div class="admin-page">
<table width="150" border="0" cellspacing="0" cellpadding="0">
<form name="mail" action="<?=$_SERVER['PHP_SELF']?>" method="post">
<tr>
    <td class="normal"><b><?php echo GENERAL_TO?>:</b></td>
    <td><input type="text" class="normal" name="textfield" value="<?=$mail->mem_email?>" size="40" disabled="disabled"></td>

<input type="hidden" name="mail_mem" value="<?=$_REQUEST['mail_mem']?>">
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td class="normal"><b><?php echo ADMINMAIL_SUB?>:</b></td></td>
    <td><input type="text" class="normal" name="subject" size="40"></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td class="normal"><b><?php echo ADMINMAIL_MESS?>:</b></td>
    <td><textarea class="normal" name="message" cols="50" rows="5"></textarea></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><input type="submit" name="mail" value="<?php echo BUTTON_SENDMAIL ?>" class="normal" ></td></tr>
	</form>
	<br>
	<br>
	<br>
</table></div></div><? }?>

