Fix #7796 - media outreach crm - needs distributed email sending (due to spam blocks)
[Pman.Core] / DataObjects / Core_notify_blacklist.php
1 <?php
2 /**
3  * Table Definition for core_notify_blacklist
4  */
5 class_exists('DB_DataObject') ? '' : require_once 'DB/DataObject.php';
6
7 class Pman_Core_DataObjects_Core_notify_blacklist extends DB_DataObject 
8 {
9     ###START_AUTOCODE
10     /* the code below is auto generated do not remove the above tag */
11
12     public $__table = 'core_notify_blacklist';    // table name
13     public $id;                              // int(11)  not_null primary_key auto_increment
14     public $server_id;
15     public $domain_id;
16     public $error_msg;
17     public $added_dt;
18     
19     
20     function messageIsBlacklisted($err)
21     {
22         $match = array(
23             '5.7.0 DT:SPM'. // 163.com
24             'on our block list ',  // live.com
25             'spameatingmonkey.net', // spameatingmonkey.net (users)
26             'sender is listed on the block', // korian?
27             'proofpoint.com', // another spam detecotr
28             'cloud-security.net', // another spam protector..
29         
30         );
31         foreach($match as $str) {
32             if (strpos($err, $str) !== false) {
33                 return true;
34             }
35         }
36         return false;
37     }
38     
39     // delete blacklists older than 1 week (and try again)
40     function prune()
41     {
42         $this->query("
43             DELETE FROM {$this->tableName()} where added_dt < NOW()  - INTERVAL 1 WEEK
44         ");
45             
46     }
47     
48 }