--- find_polls.php 2022-02-05 09:09:45.256310389 +0100 +++ find_polls.php-new 2022-02-05 09:07:28.072305772 +0100 @@ -43,8 +43,12 @@ $smarty->assign('polls', $polls); $body = $smarty->fetch('mail/find_polls.tpl'); - $mailService->send($mail, __('FindPolls', 'List of your polls') . ' - ' . NOMAPPLICATION, $body, 'SEND_POLLS'); - $message = new Message('success', __('FindPolls', 'Polls sent')); + try { + $mailService->send($mail, __('FindPolls', 'List of your polls') . ' - ' . NOMAPPLICATION, $body, 'SEND_POLLS'); + $message = new Message('success', __('FindPolls', 'Polls sent')); + } catch (Exception $e) { + $message = new Message('warning', __('Error', 'No polls found')); + } } else { $message = new Message('warning', __('Error', 'No polls found')); }