-
-
Notifications
You must be signed in to change notification settings - Fork 60
Description
Hello, I am using mail-mime-parser on a server that receives incoming emails with WAV file attachments. Since upgrading to 2.0 and migrating from Ubuntu 18 to 22, I'm getting an occasional error when processing the incoming emails via a PHP script:
"PHP Fatal error: Uncaught Error: Call to a member function getFilename() on null"
I'm simply saving the WAV file on the server for processing, then deleting it. The code block is below:
// assume only one attachment
$attachment = $message->getAttachmentPart(0);
$fname = $attachment->getFilename();
$fpath = $tempPath . $fname;
$attachment->saveContent($fpath);
$audioFile = $fpath;
I don't recall this happening very often on the old server. I noticed in the documentation there's an additional line, "
$stream = $attachment->getContentStream();" for attachments. Is this necessary when I'm only saving the file? I'm unable to see the original emails to confirm that an attachment is indeed attached, but I can work on that. Any help would be appreciated.