瀏覽代碼

Fixed missing To: header bug

Will Browning 5 年之前
父節點
當前提交
ac65f359c3
共有 2 個文件被更改,包括 5 次插入1 次删除
  1. 1 1
      app/Console/Commands/ReceiveEmail.php
  2. 4 0
      app/EmailData.php

+ 1 - 1
app/Console/Commands/ReceiveEmail.php

@@ -74,7 +74,7 @@ class ReceiveEmail extends Command
             $this->size = $this->option('size') / ($recipientCount ? $recipientCount : 1);
             $this->size = $this->option('size') / ($recipientCount ? $recipientCount : 1);
 
 
             foreach ($recipients as $key => $recipient) {
             foreach ($recipients as $key => $recipient) {
-                $displayTo = $this->parser->getAddresses('to')[$key]['display'];
+                $displayTo = $this->parser->getAddresses('to')[$key]['display'] ?? null;
 
 
                 $parentDomain = collect(config('anonaddy.all_domains'))
                 $parentDomain = collect(config('anonaddy.all_domains'))
                     ->filter(function ($name) use ($recipient) {
                     ->filter(function ($name) use ($recipient) {

+ 4 - 0
app/EmailData.php

@@ -16,6 +16,10 @@ class EmailData
         $this->attachments = [];
         $this->attachments = [];
 
 
         foreach ($parser->getAttachments() as $attachment) {
         foreach ($parser->getAttachments() as $attachment) {
+            if ($attachment->getContentType() === 'text/plain') {
+                $this->text = base64_encode($parser->getMessageBody('text'));
+            }
+
             $this->attachments[] = [
             $this->attachments[] = [
               'stream' => base64_encode(stream_get_contents($attachment->getStream())),
               'stream' => base64_encode(stream_get_contents($attachment->getStream())),
               'file_name' => $attachment->getFileName(),
               'file_name' => $attachment->getFileName(),