diff --git a/src/PhpImap/Mailbox.php b/src/PhpImap/Mailbox.php index 02a3dad9..96349eae 100644 --- a/src/PhpImap/Mailbox.php +++ b/src/PhpImap/Mailbox.php @@ -1414,7 +1414,7 @@ public function downloadAttachment(DataPartInfo $dataInfo, array $params, object if (true == $this->getAttachmentFilenameMode()) { $fileSysName = $attachment->name; } else { - $fileSysName = \bin2hex(\random_bytes(16)).'.bin'; + $fileSysName = \bin2hex(\random_bytes(16)) . '.' . $attachment->fileExtension; } $filePath = $attachmentsDir.DIRECTORY_SEPARATOR.$fileSysName;