Author |
|
AIWEB Groupie
Joined: 19 October 2010 Location: United States
Online Status: Offline Posts: 54
|
Posted: 20 November 2010 at 8:28am | IP Logged
|
|
|
Anyone have a cron script I could use for logging in and checking for new messages for all users in db?
I would like the application to check once to twice a day. I know how to set up crons but can't find any
script for cycling through accounts and checking for mail.
There is one script by an Admin (Andrew) but it doesn't work as of the newer build evidently (see below).
I get;
Fatal error: Call to undefined method CIntegration::GetAccountById() in /html/webmail/cron.php on line 17
|
Back to Top |
|
|
administrator AfterLogic Support
Joined: 10 November 2003
Online Status: Offline Posts: 22
|
Posted: 24 November 2010 at 6:16am | IP Logged
|
|
|
Are you using Lite or Pro?
This method can't be used in Lite version.
|
Back to Top |
|
|
redlorry919 Newbie
Joined: 07 December 2010
Online Status: Offline Posts: 3
|
Posted: 07 December 2010 at 7:16am | IP Logged
|
|
|
Hi,
I would also like to know this. I've configured the application to locally download all my emails via imap for multiple accounts so it would be useful to setup a cron that downloads the emails automatically say every hour, it would save waiting when initially logging into the webmail.
I'm using the Pro version.
Thanks,
Adam.
|
Back to Top |
|
|
redlorry919 Newbie
Joined: 07 December 2010
Online Status: Offline Posts: 3
|
Posted: 07 December 2010 at 1:26pm | IP Logged
|
|
|
Dont worry I've managed to cobble together something based on some previous code posted on this forum. For anyone else that wants to use it, create a separate file with the following code and replace the $_account_ids array with the ids of the accounts you want to check:
<?php
if (!defined('WM_ROOTPATH')) define('WM_ROOTPATH', (dirname(__FILE__).'/'));
require_once(WM_ROOTPATH.'comm on/inc_constants.php');
require_once(WM_ROOTPATH.'comm on/class_mailprocessor.php');
require_once(WM_ROOTPATH.'comm on/class_settings.php');
require_once(WM_ROOTPATH.'inte gr.php');
$_account_ids = array(3, 5);
foreach ($_account_ids as $ID)
{
$Integr = new CIntegration();
$Integr->GetAccountById($ID);
if (!$Integr->Account)
{
$errorString = $Integr->GetErrorString();
if ($errorString)
{
die($errorString);
}
else
{
die("user $ID doesn't exist");
}
}
$settings =& Settings::CreateInstance();
if (!$settings || !$settings->isLoad || !$settings->IncludeLang())
{
die("failed to load settings or include language");
}
$processor = &new MailProcessor($Integr->Account);
$folders = &$processor->GetFolders();
if (!$rs = $processor->Synchronize($folders))
{
die("failed to sync folders for $ID\n" . getGlobalError() . "\n");
}
unset($folders);
unset($processor);
unset($account);
unset($settings);
}
?>
|
Back to Top |
|
|
AIWEB Groupie
Joined: 19 October 2010 Location: United States
Online Status: Offline Posts: 54
|
Posted: 07 December 2010 at 3:16pm | IP Logged
|
|
|
Splendierific! Much appreciated.
|
Back to Top |
|
|
AIWEB Groupie
Joined: 19 October 2010 Location: United States
Online Status: Offline Posts: 54
|
Posted: 07 December 2010 at 3:17pm | IP Logged
|
|
|
Splenderific! Much appreciated.
|
Back to Top |
|
|