<?php
/*=======================================================================
 *
 * automailer_internal.php
 *
 * Autor: Marc Vollmann
 *
  =======================================================================*/

include_once ("mc_gen_include.inc.php");
include_once ("htmlMimeMail.php");


$auth = trim($argv[1]);
$errMsg = trim($argv[2]);

// Execution-Time for script
set_time_limit(60);


if ($auth == "comegetsome97531" && $errMsg != "") :

   $dirName = dirname(__FILE__);
   $dirName = str_replace("\\", "/", $dirName);
   $lastSlashPos = strrpos($dirName,"/");
   $path = substr($dirName, 0, $lastSlashPos);

   // Send mail to admin@assecutor.de
   $mailObj = new htmlMimeMail();
   $mailObj->setFrom("support@assecutor.de");
   $mailObj->setSubject("VOTIAN - INTERNE MELDUNG!");
      
   // PLAIN-TEXT
   $mailtext = "<" . $errMsg . ">";
   if ($errMsg == "metaobject_db_fail") :
      $mailtext .= " - " . "METAOBJECT-DATENBANK VERMUTLICH NICHT ERREICHBAR!";
   endif;
   $mailObj->setText($mailtext);
   
   $mailResult = $mailObj->send(array("admin@assecutor.de"), 'smtp');
   $mailObj = NULL;
endif;
?>
