<?php
require_once('config.php');

function insert_email_log($site_cd, $eml_log_from, $eml_log_to_email, $title, $body, $message, $audit_user){
	global $conn;
	

	$insert_email = true;
	
	
	$sql_insert_eml_log = "	INSERT eml_log (	site_cd,				eml_log_from,			eml_log_to_email,		eml_log_subject,		eml_log_content,			
												eml_log_date, 			eml_log_event,			eml_log_msg,			eml_log_status,			audit_user,				audit_date,				column1,				column2,				column3,				column4,				
												column5 )					

							 VALUES 
											(	?,						?,						?,						?,						?,						
												getdate(),						?,						?,						?,						?,	
												getdate(),						?,						?,						?,						?,	
												?)" ;

	$params_insert_eml_log = array(				$site_cd,				$eml_log_from,			$eml_log_to_email,		$title,					$message,
																		'Email Activity',		'The mail had been successfully sent.',			'S',					$audit_user,	
																		NUll,					NUll,					NUll,					NUll,					
												NUll);
									
									
	//echo 	$params_insert_eml_log;							
	$stmt_insert_eml_log = sqlsrv_query( $conn, $sql_insert_eml_log,$params_insert_eml_log);	
	if( !$stmt_insert_eml_log ) {
	$error_message = "Error (INSERT Table eml_log)";
	returnError($error_message);
	die( print_r( sqlsrv_errors(), true));
	
	$insert_email = false;
		
	}
	sqlsrv_free_stmt( $stmt_insert_eml_log);
	
	
	return $insert_email;
}


?>