Will Browning 5 лет назад
Родитель
Сommit
7ca303312a
6 измененных файлов с 221 добавлено и 185 удалено
  1. 21 0
      app/Console/Commands/ReceiveEmail.php
  2. 3 0
      app/EmailData.php
  3. 6 2
      app/Mail/ForwardEmail.php
  4. 180 172
      composer.lock
  5. 9 9
      package-lock.json
  6. 2 2
      package.json

+ 21 - 0
app/Console/Commands/ReceiveEmail.php

@@ -274,6 +274,27 @@ class ReceiveEmail extends Command
     {
     {
         $parser = new Parser;
         $parser = new Parser;
 
 
+        // Fix some edge cases in from name e.g. "\" John Doe \"" <johndoe@example.com>
+        $parser->addMiddleware(function ($mimePart, $next) {
+            $part = $mimePart->getPart();
+
+            if (isset($part['headers']['from'])) {
+                $value = $part['headers']['from'];
+                $value = (is_array($value)) ? $value[0] : $value;
+
+                try {
+                    mailparse_rfc822_parse_addresses($value);
+                } catch (\Exception $e) {
+                    report($e);
+
+                    $part['headers']['from'] = str_replace("\\\"", "", $part['headers']['from']);
+                    $mimePart->setPart($part);
+                }
+            }
+
+            return $next($mimePart);
+        });
+
         if ($file == 'stream') {
         if ($file == 'stream') {
             $fd = fopen('php://stdin', 'r');
             $fd = fopen('php://stdin', 'r');
             $this->rawEmail = '';
             $this->rawEmail = '';

+ 3 - 0
app/EmailData.php

@@ -10,6 +10,9 @@ class EmailData
     {
     {
         $this->sender = $parser->getAddresses('from')[0]['address'];
         $this->sender = $parser->getAddresses('from')[0]['address'];
         $this->display_from = base64_encode($parser->getAddresses('from')[0]['display']);
         $this->display_from = base64_encode($parser->getAddresses('from')[0]['display']);
+        if (isset($parser->getAddresses('reply-to')[0])) {
+            $this->reply_to_address = $parser->getAddresses('reply-to')[0]['address'];
+        }
         $this->subject = base64_encode($parser->getHeader('subject'));
         $this->subject = base64_encode($parser->getHeader('subject'));
         $this->text = base64_encode($parser->getMessageBody('text'));
         $this->text = base64_encode($parser->getMessageBody('text'));
         $this->html = base64_encode($parser->getMessageBody('html'));
         $this->html = base64_encode($parser->getMessageBody('html'));

+ 6 - 2
app/Mail/ForwardEmail.php

@@ -19,6 +19,7 @@ class ForwardEmail extends Mailable implements ShouldQueue
     protected $alias;
     protected $alias;
     protected $sender;
     protected $sender;
     protected $displayFrom;
     protected $displayFrom;
+    protected $replyToAddress;
     protected $emailSubject;
     protected $emailSubject;
     protected $emailText;
     protected $emailText;
     protected $emailHtml;
     protected $emailHtml;
@@ -39,6 +40,7 @@ class ForwardEmail extends Mailable implements ShouldQueue
         $this->alias = $alias;
         $this->alias = $alias;
         $this->sender = $emailData->sender;
         $this->sender = $emailData->sender;
         $this->displayFrom = $emailData->display_from;
         $this->displayFrom = $emailData->display_from;
+        $this->replyToAddress = $emailData->reply_to_address ?? null;
         $this->emailSubject = $emailData->subject;
         $this->emailSubject = $emailData->subject;
         $this->emailText = $emailData->text;
         $this->emailText = $emailData->text;
         $this->emailHtml = $emailData->html;
         $this->emailHtml = $emailData->html;
@@ -59,11 +61,13 @@ class ForwardEmail extends Mailable implements ShouldQueue
      */
      */
     public function build()
     public function build()
     {
     {
-        $replyToEmail = $this->alias->local_part.'+'.sha1(config('anonaddy.secret').$this->sender).'@'.$this->alias->domain;
+        $replyToDisplay = $this->replyToAddress ?? $this->sender;
+
+        $replyToEmail = $this->alias->local_part.'+'.sha1(config('anonaddy.secret').$replyToDisplay).'@'.$this->alias->domain;
 
 
         $email =  $this
         $email =  $this
             ->from(config('mail.from.address'), base64_decode($this->displayFrom)." '".$this->sender."' via ".config('app.name'))
             ->from(config('mail.from.address'), base64_decode($this->displayFrom)." '".$this->sender."' via ".config('app.name'))
-            ->replyTo($replyToEmail, $this->sender)
+            ->replyTo($replyToEmail, $replyToDisplay)
             ->subject($this->user->email_subject ?? base64_decode($this->emailSubject))
             ->subject($this->user->email_subject ?? base64_decode($this->emailSubject))
             ->text('emails.forward.text')->with([
             ->text('emails.forward.text')->with([
                 'text' => base64_decode($this->emailText)
                 'text' => base64_decode($this->emailText)

Разница между файлами не показана из-за своего большого размера
+ 180 - 172
composer.lock


+ 9 - 9
package-lock.json

@@ -2519,9 +2519,9 @@
             "integrity": "sha1-6vQ5/U1ISK105cx9vvIAZyueNFs="
             "integrity": "sha1-6vQ5/U1ISK105cx9vvIAZyueNFs="
         },
         },
         "dayjs": {
         "dayjs": {
-            "version": "1.8.16",
-            "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.8.16.tgz",
-            "integrity": "sha512-XPmqzWz/EJiaRHjBqSJ2s6hE/BUoCIHKgdS2QPtTQtKcS9E4/Qn0WomoH1lXanWCzri+g7zPcuNV4aTZ8PMORQ=="
+            "version": "1.8.17",
+            "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.8.17.tgz",
+            "integrity": "sha512-47VY/htqYqr9GHd7HW/h56PpQzRBSJcxIQFwqL3P20bMF/3az5c3PWdVY3LmPXFl6cQCYHL7c79b9ov+2bOBbw=="
         },
         },
         "de-indent": {
         "de-indent": {
             "version": "1.0.2",
             "version": "1.0.2",
@@ -9184,9 +9184,9 @@
             "integrity": "sha512-ImThpeNU9HbdZL3utgMCq0oiMzAkt1mcgy3/E6zWC/G6AaQoeuFdsl9nDhTDU3X1R6FK7nsIUuRACVcjI+A2GQ=="
             "integrity": "sha512-ImThpeNU9HbdZL3utgMCq0oiMzAkt1mcgy3/E6zWC/G6AaQoeuFdsl9nDhTDU3X1R6FK7nsIUuRACVcjI+A2GQ=="
         },
         },
         "vue-good-table": {
         "vue-good-table": {
-            "version": "2.18.0",
-            "resolved": "https://registry.npmjs.org/vue-good-table/-/vue-good-table-2.18.0.tgz",
-            "integrity": "sha512-wC0I9D7TyfSf0zrYwIpNtXdbSPRir//q7TNpGZ8/MfgW5mLMspk9I0MVq856M3ecgwTqgqXXtO87+i0sgQxALg==",
+            "version": "2.18.1",
+            "resolved": "https://registry.npmjs.org/vue-good-table/-/vue-good-table-2.18.1.tgz",
+            "integrity": "sha512-W9D5M87GgzgQowtWVARqxSwSvHx0MKnKV5d9Zlz5Fx3XfuJWm4lufZUpWlTwKTbLWoG4cLjHd6N0m55S9Ild3Q==",
             "requires": {
             "requires": {
                 "date-fns": "^2.0.0-beta.4",
                 "date-fns": "^2.0.0-beta.4",
                 "diacriticless": "1.0.1",
                 "diacriticless": "1.0.1",
@@ -9198,9 +9198,9 @@
             },
             },
             "dependencies": {
             "dependencies": {
                 "date-fns": {
                 "date-fns": {
-                    "version": "2.2.1",
-                    "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.2.1.tgz",
-                    "integrity": "sha512-4V1i5CnTinjBvJpXTq7sDHD4NY6JPcl15112IeSNNLUWQOQ+kIuCvRGOFZMQZNvkadw8F9QTyZxz59rIRU6K+w=="
+                    "version": "2.7.0",
+                    "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.7.0.tgz",
+                    "integrity": "sha512-wxYp2PGoUDN5ZEACc61aOtYFvSsJUylIvCjpjDOqM1UDaKIIuMJ9fAnMYFHV3TQaDpfTVxhwNK/GiCaHKuemTA=="
                 }
                 }
             }
             }
         },
         },

+ 2 - 2
package.json

@@ -13,7 +13,7 @@
     "dependencies": {
     "dependencies": {
         "axios": "^0.18.1",
         "axios": "^0.18.1",
         "cross-env": "^5.2.1",
         "cross-env": "^5.2.1",
-        "dayjs": "^1.8.16",
+        "dayjs": "^1.8.17",
         "laravel-mix": "^4.1.4",
         "laravel-mix": "^4.1.4",
         "laravel-mix-purgecss": "^4.2.0",
         "laravel-mix-purgecss": "^4.2.0",
         "lodash": "^4.17.15",
         "lodash": "^4.17.15",
@@ -25,7 +25,7 @@
         "tippy.js": "^4.3.5",
         "tippy.js": "^4.3.5",
         "v-clipboard": "^2.2.2",
         "v-clipboard": "^2.2.2",
         "vue": "^2.6.10",
         "vue": "^2.6.10",
-        "vue-good-table": "^2.18.0",
+        "vue-good-table": "^2.18.1",
         "vue-multiselect": "^2.1.6",
         "vue-multiselect": "^2.1.6",
         "vue-notification": "^1.3.20",
         "vue-notification": "^1.3.20",
         "vue-template-compiler": "^2.6.10"
         "vue-template-compiler": "^2.6.10"

Некоторые файлы не были показаны из-за большого количества измененных файлов