I would like to create a log in the Database everytime i send or receive an email. I need to receive an event from outlook everytime an email is sent or a contact is created. The server is a LINUX server on Amazon https://aws.amazon.com/amazon-linux-ami/2017.09-release-notes/
The code that I have tried so far is as below.
function wh_log($log_msg)
{
$log_filename = "log";
if (!file_exists($log_filename))
{
mkdir($log_filename, 0777, true);
}
$log_file_data = $log_filename.'/log_' . date('d-M-Y') . '.log';
file_put_contents($log_file_data, $log_msg . "\n", FILE_APPEND);
}
Its not working. May I know what am I doing in-correct?