Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent exception on maillcollector connection #7698

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions inc/mailcollector.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ function showForm($ID, $options = []) {
public function displayFoldersList($input_id = "") {
try {
$this->connect();
} catch (\Laminas\Mail\Protocol\Exception\RuntimeException $e) {
} catch (Throwable $e) {
Toolbox::logError($e->getMessage());
echo __('An error occured trying to connect to collector.');
return;
Expand Down Expand Up @@ -578,7 +578,12 @@ function deleteOrImportSeveralEmails($emails_ids = [], $action = 0, $entity = 0)

$collector->uid = -1;
//Connect to the Mail Box
$collector->connect();
try {
$collector->connect();
} catch (Throwable $e) {
Toolbox::logError('An error occured trying to connect to collector.', $e->getMessage());
continue;
}

foreach ($collector->storage as $uid => $message) {
$head = $collector->getHeaders($message);
Expand Down Expand Up @@ -668,7 +673,7 @@ function collect($mailgateID, $display = 0) {
//Connect to the Mail Box
try {
$this->connect();
} catch (\Laminas\Mail\Protocol\Exception\RuntimeException $e) {
} catch (Throwable $e) {
Toolbox::logError($e->getTraceAsString());
Session::addMessageAfterRedirect(
__('An error occured trying to connect to collector.') . "<br/>" . $e->getMessage(),
Expand Down