-
Notifications
You must be signed in to change notification settings - Fork 460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] Avoid fetching attachments if it's already downloaded #585
Comments
I've made a quick fix. This works for me.
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);
}
return $this->decodeAfterFetch();
} BTW, since only a "Content-ID" is also enough: php-imap/src/PhpImap/IncomingMail.php Lines 222 to 226 in e933976
It's may better to change this line to |
…-when-already-downloaded #585: Avoid fetching attachments when they are already downloaded
Thank you very much for this code improvement @yrccondor! I've implemented and tested it. |
This feature/change has been released in version 4.5.0. |
I'm using this library for a while, and it's really helpful!
I noticed that when I dealing with mails with multiple inline iamges (cid:...),
IncommingMail::embedImageAttachments()
took a very long time to process (I've set$attachmentsDir
tonull
). I found that forevery call to
IncomingMailAttachment::getContents()
will eventually callimap_fetchbody
inImap::fetchbody()
, which took a long time to fetch.Since we already have attachment data in
DataPartInfo::data
, can we just return it inDataPartInfo::fetch()
if data is set or add a getter forDataPartInfo::data
?I'm not really familiar with imap, sorry if I'm wrong.
The text was updated successfully, but these errors were encountered: