diff --git a/src/Services/EmlFileManager.php b/src/Services/EmlFileManager.php index 03ecbec..b8718ab 100644 --- a/src/Services/EmlFileManager.php +++ b/src/Services/EmlFileManager.php @@ -27,7 +27,9 @@ public function writeFile(string $id, string $content): string throw new \RuntimeException('Cannot compress eml file'); } - $emlFilePath = 'mails/' . $id . '.eml.gz'; + $folderParts = \array_slice(\str_split($id, 2), 0, 3); + + $emlFilePath = 'mails/' . \implode('/', $folderParts) . '/' . $id . '.eml.gz'; $this->filesystem->write($emlFilePath, $content);