Search The ForumSearch   RegisterRegister  LoginLogin

AfterLogic WebMail Pro

 AfterLogic Forum : AfterLogic WebMail Pro
Subject Topic: Cron Email Script Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
AIWEB
Groupie
Groupie
Avatar

Joined: 19 October 2010
Location: United States
Online Status: Offline
Posts: 54
Posted: 20 November 2010 at 8:28am | IP Logged Quote AIWEB

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 View AIWEB's Profile Search for other posts by AIWEB
 
administrator
AfterLogic Support
AfterLogic Support


Joined: 10 November 2003
Online Status: Offline
Posts: 22
Posted: 24 November 2010 at 6:16am | IP Logged Quote administrator

Are you using Lite or Pro?

This method can't be used in Lite version.
Back to Top View administrator's Profile Search for other posts by administrator
 
redlorry919
Newbie
Newbie


Joined: 07 December 2010
Online Status: Offline
Posts: 3
Posted: 07 December 2010 at 7:16am | IP Logged Quote redlorry919

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 View redlorry919's Profile Search for other posts by redlorry919
 
redlorry919
Newbie
Newbie


Joined: 07 December 2010
Online Status: Offline
Posts: 3
Posted: 07 December 2010 at 1:26pm | IP Logged Quote redlorry919

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 View redlorry919's Profile Search for other posts by redlorry919
 
AIWEB
Groupie
Groupie
Avatar

Joined: 19 October 2010
Location: United States
Online Status: Offline
Posts: 54
Posted: 07 December 2010 at 3:16pm | IP Logged Quote AIWEB

Splendierific! Much appreciated.
Back to Top View AIWEB's Profile Search for other posts by AIWEB
 
AIWEB
Groupie
Groupie
Avatar

Joined: 19 October 2010
Location: United States
Online Status: Offline
Posts: 54
Posted: 07 December 2010 at 3:17pm | IP Logged Quote AIWEB

Splenderific! Much appreciated.
Back to Top View AIWEB's Profile Search for other posts by AIWEB
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide