69 lines
2.2 KiB
PHP
69 lines
2.2 KiB
PHP
<?php
|
|
/*=======================================================================
|
|
*
|
|
* automailer_internal.php
|
|
*
|
|
* Autor: Marc Vollmann
|
|
*
|
|
=======================================================================*/
|
|
|
|
include_once ("../include/mcglobal.inc.php");
|
|
// include_once ("../include/image.inc.php");
|
|
include_once ('../include/email/htmlMimeMail.php');
|
|
|
|
|
|
// getSecHttpVars("0", array("auth", "errMsg"));
|
|
|
|
$auth = trim($argv[1]);
|
|
$errMsg = trim($argv[2]);
|
|
|
|
// Execution-Time for script
|
|
set_time_limit(120);
|
|
|
|
// Writes a string to a file optional with or without linefeed
|
|
function writeToInternalMailLogFile($fileName, $stringToOperate, $mode = 'a', $noLf = "") {
|
|
$fileHandle = fopen($fileName, $mode);
|
|
if ($noLf == "") : $stringToOperate .= "\n"; endif;
|
|
$opCode = fwrite($fileHandle, $stringToOperate);
|
|
fclose($fileHandle);
|
|
return $opCode;
|
|
}
|
|
|
|
writeToInternalMailLogFile("test_internal_mail.log", $auth . " | " . $errMsg);
|
|
|
|
if ($auth == "comegetsome97531" && $errMsg != "") :
|
|
|
|
$dirName = dirname(__FILE__);
|
|
$dirName = str_replace("\\", "/", $dirName);
|
|
$lastSlashPos = strrpos($dirName,"/");
|
|
$path = substr($dirName, 0, $lastSlashPos);
|
|
|
|
$currentTime = getDateTime("0");
|
|
$currentClientIP = trim($_SERVER['REMOTE_ADDR']);
|
|
writeToInternalMailLogFile("test_internal_mail.log", $currentTime . " | " . $currentClientIP);
|
|
|
|
// Send mail to admin@assecutor.de
|
|
$mailObj = new htmlMimeMail();
|
|
$mailObj->setFrom("admin@assecutor.de");
|
|
// $mailObj->setCc($mailCcAddress);
|
|
// $mailObj->setBcc($mailBccAddress);
|
|
$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("dev@assecutor.de"), 'smtp');
|
|
if ($mailResult) :
|
|
writeToInternalMailLogFile("test_internal_mail.log", "MAIL SENT!");
|
|
else :
|
|
writeToInternalMailLogFile("test_internal_mail.log", "MAIL NOT SENT!");
|
|
endif;
|
|
$mailObj = NULL;
|
|
writeToInternalMailLogFile("test_internal_mail.log", "---------------------------------------------------");
|
|
endif;
|
|
?>
|