summaryrefslogtreecommitdiffstats
path: root/includes
diff options
context:
space:
mode:
Diffstat (limited to 'includes')
-rw-r--r--includes/emails.php22
1 files changed, 9 insertions, 13 deletions
diff --git a/includes/emails.php b/includes/emails.php
index 7a54a89..9b5d124 100644
--- a/includes/emails.php
+++ b/includes/emails.php
@@ -25,7 +25,6 @@ function SendQueuedEmail() {
return false;
}
- //echo "<br> Checking Queue";
//Check the Queue
$res = $mysqli->query("SELECT `emailID`
FROM `emailQueue`
@@ -57,27 +56,24 @@ function SendQueuedEmail() {
$body = $response['body'];
$success = SendEmail($body, $subject, $to);
+
+ //Success or fail, we still want this deleted.
+ $mysqli->query("DELETE FROM `emailQueue` WHERE `emailID` = $emailID");
+
+ //TODO: Handle failed emails someplace.
if (!$success) {
- $res = $mysqli->query("DELETE FROM `emailQueue` WHERE `ID` = $emailID");
- $res = $mysqli->query("UPDATE `emails` SET `error` = 'Failed to send' WHERE `ID` = $emailID");
+ $mysqli->query("UPDATE `emails` SET `error` = 'Failed to send' WHERE `ID` = $emailID");
return false;
}
- //I declare this letter sent!
- $res = $mysqli->query("DELETE FROM `emailQueue` WHERE `ID` = $emailID");
- $res = $mysqli->query("UPDATE `settings` SET `value` = UNIX_TIMESTAMP(NOW()) WHERE `name` = 'Email_Last_Sent'");
- $res = $mysqli->query("UPDATE `emails` SET `dateSent` = NOW() WHERE `ID` = $emailID");
+ //Success!
+ $mysqli->query("UPDATE `settings` SET `value` = UNIX_TIMESTAMP(NOW()) WHERE `name` = 'Email_Last_Sent'");
+ $mysqli->query("UPDATE `emails` SET `dateSent` = NOW() WHERE `ID` = $emailID");
- //echo "<br> Deletes Complete";
} catch (Exception $exc) { /* Ignore... :| */ }
//Release Lock
releaseEmailLock($lock);
- //TODO !!
- //echo "<br>I DIDN'T SEND THIS: ($body, $subject, $to)<br>";
- //SendEmail($body, $subject, "snapwilliam@gmail.com");
- //SendEmail($body, $subject, $to);
-
return true;
}