You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
Nothing jumps out, from what you said it may be an issue with specific emails, you'll need to take a look at which emails are causing the issue to narrow it down (you could check if $attachment is null and write out the whole email instead, or log details about the email so you can look it up if you have access to it elsewhere).
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.
The text was updated successfully, but these errors were encountered: