forked from elkarte/Elkarte
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathemail_imap_cron.php
More file actions
55 lines (45 loc) · 1.02 KB
/
email_imap_cron.php
File metadata and controls
55 lines (45 loc) · 1.02 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
/**
* Should be run from a cron job to fetch messages from an imap mailbox
* Can also be called from scheduled tasks (fake-cron) if needed
*
* @package ElkArte Forum
* @copyright ElkArte Forum contributors
* @license BSD http://opensource.org/licenses/BSD-3-Clause (see accompanying LICENSE.txt file)
*
* @version 2.0 Beta 1
*
*/
use ElkArte\Maillist\MaillistImap;
// Any output here is not good
error_reporting(0);
// Being run as a cron job
if (!defined('ELK'))
{
global $ssi_guest_access;
require_once(__DIR__ . '/bootstrap.php');
$ssi_guest_access = true;
new Bootstrap(true);
postbyemail_imap();
// Need to keep the cli clean on return
exit(0);
}
// Or a scheduled task
postbyemail_imap();
/**
* postbyemail_imap()
*
* Starts the posting of new messages found in the imap account
* or the .eml file
*
* Called by a scheduled task or cronjob
*/
function postbyemail_imap()
{
// No imap, why bother?
if (!function_exists('imap_open'))
{
return false;
}
return (new MaillistImap())->process();
}