Environment
- PHP version: 8.5.0
- ImapEngine version: 1.24.1
- IMAP server: (e.g., Gmail, Yahoo, etc.) different (own/not controlled)
Unfortunetaly I have to fetch a special string out if the attached contents at each message to be able when storing the file using that piece of information in the title.
To get this piece (string) out of the content, I am using
$attachment->contents()
That works quite well, but the problem is when I try to store the attachment there is NO content anymore!
The script use:
use DirectoryTree\ImapEngine\Message;
use DirectoryTree\ImapEngine\DraftMessage;
Then (inside a class):
$this->mailbox = new Mailbox($this->usedOption);
(usedOption is own array with several dynamic options)
Further:
$messages = $inbox->messages()
->withHeaders()
->withFlags()
->withBody()
->get();
Looping now over all messages and attachments, I use this:
$content = htmlspecialchars($attachment->contents(), ENT_NOQUOTES, 'UTF-8');
to get the content and strip the required string.
Until this step everything works as expected.
But then using to store the attachment
$attachment->save(INCOMING . $filename)
the file is created but with NO content (0 bytes)!
Either I am doing something wrong or your scripts are pulling the content and leave nothing to store ..
Tried now several hours different approaches - with no result.
If I do not use $attachment->contents() everything works and is stored with content (but I require that string out of the content)!
Do you have a solution?
Environment
Unfortunetaly I have to fetch a special string out if the attached contents at each message to be able when storing the file using that piece of information in the title.
To get this piece (string) out of the content, I am using
$attachment->contents()That works quite well, but the problem is when I try to store the attachment there is NO content anymore!
The script use:
Then (inside a class):
$this->mailbox = new Mailbox($this->usedOption);(usedOption is own array with several dynamic options)
Further:
Looping now over all messages and attachments, I use this:
$content = htmlspecialchars($attachment->contents(), ENT_NOQUOTES, 'UTF-8');to get the content and strip the required string.
Until this step everything works as expected.
But then using to store the attachment
$attachment->save(INCOMING . $filename)the file is created but with NO content (0 bytes)!
Either I am doing something wrong or your scripts are pulling the content and leave nothing to store ..
Tried now several hours different approaches - with no result.
If I do not use
$attachment->contents()everything works and is stored with content (but I require that string out of the content)!Do you have a solution?