Merge pull request #8 from iyzoer/fixes-undefined-index

fixes undefined property
This commit is contained in:
Akolzin Dmitry 2024-02-08 12:28:21 +03:00 committed by GitHub
commit 521f7bcff7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 2 deletions

View File

@ -134,7 +134,9 @@ class Attachment
$this->setFileName($parameters['name']);
}
$this->size = $structure->bytes;
if (property_exists($structure, 'bytes')) {
$this->size = $structure->bytes;
}
$this->mimeType = Message::typeIdToString($structure->type);

View File

@ -764,7 +764,13 @@ class Message
foreach ($addresses as $address) {
if (property_exists($address, 'mailbox') && $address->mailbox != 'undisclosed-recipients') {
$currentAddress = array();
$currentAddress['address'] = $address->mailbox . '@' . $address->host;
$host = '';
if (property_exists($address, 'host')) {
$host = $address->host;
}
$currentAddress['address'] = $address->mailbox . '@' . $host;
if (isset($address->personal)) {
$currentAddress['name'] = MIME::decode($address->personal, self::$charset);
}