This repository has been archived on 2023-05-21. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
SYSDesk/mail-cron.php
2019-08-15 11:47:44 +02:00

30 lines
878 B
PHP

<?php
define('DB_SERVER', '');
define('DB_USERNAME', '');
define('DB_PASSWORD', '');
define('DB_NAME', '');
/* Attempt to connect to MySQL database */
$link = mysqli_connect(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME);
// Check connection
if($link === false){
die("ERROR: Could not connect. " . mysqli_connect_error());
}
$msg = 'There are open tickets in SYSDesk!';
$sql = "SELECT * FROM tickets";
if($result = mysqli_query($link, $sql)){
if(mysqli_num_rows($result) > 0){
while($row = mysqli_fetch_array($result)){
mail('J.vos@ictmaatwerk.com','Sample Form',$msg,);
echo "Mail succesfully sent.";
}
mysqli_free_result($result);
} else{
echo "No tickets were found.";
}
} else{
echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
}
?>