ddeboer / imap

Object-oriented, fully tested PHP IMAP library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Undefined property: subtype

mastermind115 opened this issue · comments

Summary

If message has attachment with undefined subtype, any call to attachment related method triggers notice "Undefined property: stdClass::$subtype".

Current behavior

Message/AbstractPart::isAttachment (row 423) do not check if property exists.

How to reproduce: code & error stack trace

I have message in Inbox from Gmail stating that the target email account do not exist. It has 2 attachments:

  • original message (no problems).
  • status report with "Content-Type: message/delivery-status". (problem)

Expected behavior

Row 423 should be something like:
if (property_exists($part, 'subtype') and self::SUBTYPE_RFC822 === \strtoupper($part->subtype)) {

Could you please post here the message/delivery-status attachment?

Sure. I copied that from getRawMessage() output:

--00000000000078125c05b7095328\r\n
Content-Type: message/delivery-status\r\n
\r\n
Reporting-MTA: dns; googlemail.com\r\n
Received-From-MTA: dns; xxx@yyy.com\r\n
Arrival-Date: Tue, 22 Dec 2020 00:26:06 -0800 (PST)\r\n
X-Original-Message-ID: <1e7e213c-2d74-4f99-813c-088fe85010a6@yyy.com>\r\n
\r\n
Final-Recipient: rfc822; abcdef@money.com\r\n
Action: failed\r\n
Status: 5.0.0\r\n
Diagnostic-Code: smtp; The email account that you tried to reach does not exist. Please try double-checking the recipient's email address for typos or unnecessary spaces. Learn more at https://support.google.com/mail/answer/6596\r\n
Last-Attempt-Date: Tue, 22 Dec 2020 00:26:06 -0800 (PST)\r\n
\r\n