mirror of
https://github.com/retailcrm/Fetch.git
synced 2025-02-06 02:39:21 +03:00
Merge pull request #6 from iyzoer/warning-fixes
[fix] add subject property check
This commit is contained in:
commit
40025f2dea
@ -100,12 +100,14 @@ class Attachment
|
|||||||
try {
|
try {
|
||||||
$hObject = imap_rfc822_parse_headers($header);
|
$hObject = imap_rfc822_parse_headers($header);
|
||||||
|
|
||||||
$subject = MIME::decode($hObject->subject, Message::$charset);
|
if (property_exists($hObject, 'subject')) {
|
||||||
$subject = preg_replace('#\s+#', ' ', $subject);
|
$subject = MIME::decode($hObject->subject, Message::$charset);
|
||||||
$subject = preg_replace('#^(.{0,50})#u', '$1', $subject);
|
$subject = preg_replace('#\s+#', ' ', $subject);
|
||||||
|
$subject = preg_replace('#^(.{0,50})#u', '$1', $subject);
|
||||||
|
|
||||||
if ($subject) {
|
if ($subject) {
|
||||||
$this->filename = $subject . '.eml';
|
$this->filename = $subject . '.eml';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user