<?php
function sendMailPW($usename, $email, $new_pw){
	$result = false;
	$subject="=?UTF-8?B?".base64_encode('CMS password reset')."?=";//信件標題，解決亂碼問題

	$mail_content = 'Hi '.$usename.', <br><br>';
	$mail_content .= 'Your CMS password of '.$_SERVER['SERVER_NAME'].' has been reseted as below<br><br>';
	$mail_content .= $new_pw.'<br><br>';
	$mail_content .= 'Reseted by this IP '.$_SERVER["REMOTE_ADDR"].'<br><br>';
	$mail_content .= '*Never tell anyone of your password!<br>*Do not reply this email.<br><br>AWEsome CMS 2.0 by All People Ltd,.<br>www.allpeople.com.hk';

	$header_name="=?UTF-8?B?".base64_encode('AWEsome CMS 2.0')."?=";
	
	$headers = "MIME-Version: 1.0\r\n";
	$headers .= "Content-type: text/html; charset=big5\r\n";
	$headers .= "From: ".$header_name."<no-reply@allpeople.com.hk>\r\n";
	$headers .= "Reply-To: AWEsome CMS 2.0  <no-reply@allpeople.com.hk>\r\n";
	$headers .= "X-Mailer: PHP/".phpversion();
	
	if(mail($email,$subject,$mail_content,$headers)){
		$result = true;
	} else {
		$result = false;
	}
	return $result;
}

function sendNewAdmin($usename, $email, $new_pw){
	$result = false;

	$subject="=?UTF-8?B?".base64_encode('CMS Account Created!')."?=";//信件標題，解決亂碼問題

	$mail_content = 'Hi '.$usename.', <br><br>';
	$mail_content .= 'Your account is created fo the CMS of '.$_SERVER['SERVER_NAME'].', below is the login ID and Password.<br><br>';
	$mail_content .= 'ID: '.$usename.'<br>Password: '.$new_pw.'<br><br>';
	$mail_content .= 'Remeber to change your password.<br><br>';
	$mail_content .= '*Never tell anyone of your password!<br>*Do not reply this email.<br><br>AWEsome CMS 2.0 by All People Ltd,.<br>www.allpeople.com.hk';

	$header_name="=?UTF-8?B?".base64_encode('AWEsome CMS 2.0')."?=";
	
	$headers = "MIME-Version: 1.0\r\n";
	$headers .= "Content-type: text/html; charset=big5\r\n";
	$headers .= "From: ".$header_name."<no-reply@allpeople.com.hk>\r\n";
	$headers .= "Reply-To: AWEsome CMS 2.0  <no-reply@allpeople.com.hk>\r\n";
	$headers .= "X-Mailer: PHP/".phpversion();
	
	if(mail($email,$subject,$mail_content,$headers)){
		$result = true;
	} else {
		$result = false;
	}
	return $result;
}
?>