-// Search for mails from deleted members?
-if (getConfig('ap_del_mails') == "Y") {
- // Okay, let's check for them...
- $since = bigintval(getConfig('ap_dm_timeout'));
- $result_mails = SQL_QUERY_ESC("SELECT sender\
-FROM `{!MYSQL_PREFIX!}_pool`
-WHERE data_type='DELETED' AND timestamp <= (UNIX_TIMESTAMP() - %s)
-ORDER BY sender ASC",
- array($since), __FILE__, __LINE__);
+// Okay, let's check for deleted mails
+$result_mails = SQL_QUERY("SELECT
+ `sender`
+FROM
+ `{?_MYSQL_PREFIX?}_pool`
+WHERE
+ `data_type`='DELETED' AND `timestamp` <= (UNIX_TIMESTAMP() - {?ap_dm_timeout?})
+ORDER BY
+ `sender` ASC", __FILE__, __LINE__);
+
+// Reset counter...
+$deletedStats = '0';
+
+// Do we have "purged" mails?
+if (SQL_NUMROWS($result_mails) > 0) {
+ // Okay, check for their sender's
+ while ($content = SQL_FETCHARRAY($result_mails)) {
+ // Check now...
+ if (!fetchUserData($content['sender'])) {
+ // Okay we found some mails!
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_pool` WHERE `sender`=%s",
+ array(bigintval($content['sender'])), __FILE__, __LINE__);