From b17fd7004e9e6b469a9fc2c3df9b1379a5ba9201 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 8 Jun 2016 15:15:01 +0200 Subject: [PATCH] * Admin: fix async service testjob to run on a default install (no phpgwapi) --- admin/inc/class.admin_asyncservice.inc.php | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/admin/inc/class.admin_asyncservice.inc.php b/admin/inc/class.admin_asyncservice.inc.php index 88d938855c..cb19e5fbbf 100644 --- a/admin/inc/class.admin_asyncservice.inc.php +++ b/admin/inc/class.admin_asyncservice.inc.php @@ -190,15 +190,22 @@ class admin_asyncservice echo $GLOBALS['egw']->framework->footer(); } + /** + * Callback for test-job + * + * @param string $to email address to send mail to + */ function test($to) { - $returncode = $GLOBALS['egw']->send->msg('email',$to,$subject='Asynchronous timed services','Greetings from cron ;-)'); - - if (!$returncode) // not nice, but better than failing silently - { - echo "

bocalendar::send_update: sending message to '$to' subject='$subject' failed !!!
\n"; - echo $GLOBALS['egw']->send->err['desc']."

\n"; + try { + $mail = new Api\Mailer(); + $mail->setBody('Greetings from cron ;-)'); + $mail->addHeader('Subject', 'Asynchronous timed services'); + $mail->addAddress($to); + $mail->send(); + } + catch (Exception $e) { + _egw_log_exception($e); } - //print_r($GLOBALS['egw_info']['user']); } }