-
Notifications
You must be signed in to change notification settings - Fork 3
/
cron.php
38 lines (33 loc) · 865 Bytes
/
cron.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
//Setup
require_once( __DIR__ . '/config.php' );
require_once( __DIR__ . '/rules.php' );
require_once( __DIR__ . '/logger.php' );
require_once( __DIR__ . '/imap.php' );
//Sendprovider
require_once( __DIR__ . '/telegram.php' );
require_once( __DIR__ . '/overview.php' );
//get mails
$i = new IMAP( CONFIG::$MAIL );
$mess = $i->getNew();
//overview
$overview = new Overview();
//check rules
foreach( $mess as $msg ){
foreach( RULES::TELEGRAM as $rule ){
if( count( array_intersect( $rule['mailto'], $msg['to'] )) > 0){
foreach( $rule['telto'] as $to ){
sendtelegram( $to, $msg, $rule['tag'] );
}
}
}
foreach( RULES::MAILOVERVIEW as $rule ){
if( in_array( $rule['mailto'], $msg['to'] ) ){
foreach( $rule['telto'] as $to ){
$overview->addMail( $to, $msg['subject'], $msg['from'], $rule['tag']);
}
}
}
}
$overview->send();
?>