php - Get attachments with IMAP
one text
Hello Im trying to get all email Attachments from my email inbox with the PHP Laminas Framework I tried this but it wouldn't work im not sure why... how do i extract attachments with laminas from emails?
use Laminas\Mail\Storage\Imap;
use Laminas\Mail\Exception;
$mail = new Imap(array(
'host' => 'outlook.office365.com',
'port' => '993',
'user' => 'lorem@lorem.com',
'password' => 'lorem123',
'ssl' => 'SSL'));
$numMessages = $mail->countMessages();
while($numMessages) {
$part = $mail->getMessage($numMessages);
while ($part->isMultipart()) {
$part = $mail->getPart(2);
}
echo 'type: ' . strtok($part->contentType, ';') . "\n";
echo "content:\n";
echo $part->getContent();
}
Sourcefatal error: Uncaught Error: Call to undefined method Laminas\Mail\Storage\Imap::getPart() in /var/www/html/face/views/class.Email.php:94 Stack trace: #0 /var/www/html/face/inc/inc.ClassView.php(57): Face_View_Email->show() #1 /var/www/html/face/out/out.Email.php(20): Face_View->__invoke() #2 {main} thrown in /var/www/html/face/views/class.Email.php