diff --git a/include/class.mailfetch.php b/include/class.mailfetch.php index 72dcc6eeefcf8ac58b583559868aa442bb25d62d..eaa1ebcdd792afd61c4f252b5c38c2eae660618b 100644 --- a/include/class.mailfetch.php +++ b/include/class.mailfetch.php @@ -558,14 +558,18 @@ class MailFetcher { && ($attachments = $this->getAttachments($struct))) { foreach ($attachments as $i=>$info) { if (0 === strcasecmp('application/ms-tnef', $info['type'])) { - $data = $this->decode(imap_fetchbody($self->mbox, - $mid, $info['index']), $info['encoding']); - $tnef = new TnefStreamParser($data); - $this->tnef = $tnef->getMessage(); - // No longer considered an attachment - unset($attachments[$i]); - // There should only be one of these - break; + try { + $data = $this->decode(imap_fetchbody($this->mbox, + $mid, $info['index']), $info['encoding']); + $tnef = new TnefStreamParser($data); + $this->tnef = $tnef->getMessage(); + // No longer considered an attachment + unset($attachments[$i]); + // There should only be one of these + break; + } catch (TnefException $ex) { + // Noop -- winmail.dat remains an attachment + } } } } @@ -627,7 +631,7 @@ class MailFetcher { if(!$ost->isFileTypeAllowed($file)) { $file['error'] = 'Invalid file type (ext) for '.Format::htmlchars($file['name']); } - else { + elseif (!$file['data']) { // only fetch the body if necessary $self = $this; $file['data'] = function() use ($self, $mid, $a) {