<?php

require_once('conf.php');

/*
Generates and sends a email to notify devs of a new or updated exception report
*/
function reportEmail($app, $version, $msg, $status, $id){
  $companyEmail = EMAIL;
  $url = REPORT_URL;

$email = <<<EMAIL

$app $version has generated the following exception:

$msg

$url$id

This email was generated by the Twenty Codes, LLC Exception Handler.
EMAIL;

  mail( 'arsenickiss7891@gmail.com' , "$status excpetion report for $app $version" , $email, "From: Exception Handler" );

  /*
  The following was used if mail() doesnt work. This method seems to be problematic
  $temp = fopen("/exceptionhandler/email", 'w');      
  fwrite($temp, $email);
  fclose($temp);    
  shell_exec("ssmtp -t < /exceptionhandler/email");  
  unlink("/exceptionhandler/email");
  */
  }
?>
