When using this function in conjunction with the MS Exchange.
Did this error occur when using other email services?
In my case, the solution was:
IncomingMail.php 49:
- $replace[] = $baseUri . basename($this->attachments[$attachmentId]->filePath);
+ $replace[] = $baseUri . basename($this->attachments[$attachment->id]->filePath);