From d227aec2ab94f3bb892f997ef2d6550e760f0701 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Kr=C3=A4tzig?= Date: Sat, 8 Jan 2022 17:58:13 +0100 Subject: [PATCH] #585: Avoid fetching attachments when they are already downloaded --- src/PhpImap/DataPartInfo.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/PhpImap/DataPartInfo.php b/src/PhpImap/DataPartInfo.php index fc2ddcd0..2bb51dfb 100644 --- a/src/PhpImap/DataPartInfo.php +++ b/src/PhpImap/DataPartInfo.php @@ -79,6 +79,9 @@ public function fetch(): string if (0 === $this->part) { $this->data = Imap::body($this->mail->getImapStream(), $this->id, $this->options); } else { + if (null !== $this->data) { + return $this->data; + } $this->data = Imap::fetchbody($this->mail->getImapStream(), $this->id, $this->part, $this->options); }