Browse Source

Fixed issue with emails already encrypted

Will Browning 5 years ago
parent
commit
391efa9728

+ 6 - 0
README.md

@@ -149,6 +149,12 @@ You can even use the send from feature to create an alias on the fly that does n
 
 You must generate aliases that use shared domains (e.g. circus.waltz449@anonaddy.me) beforehand in order to be able to send from them.
 
+If you need to send an email to an address with an extension e.g. **hello+whatever@example.com** then it's exactly the same method:
+
+<span class="break-words"><first+hello+whatever=example.com@johndoe.anonaddy.com></span>
+
+Just enter the extension too!
+
 #### **Will people see my real email if I reply to a forwarded one?**
 
 No, your real email will not be shown, the email will look as if it has come from us instead. Just make sure not to include anything that might identify you when composing the reply, i.e. your full name.

+ 10 - 6
app/EmailData.php

@@ -18,12 +18,16 @@ class EmailData
         $this->html = base64_encode($parser->getMessageBody('html'));
         $this->attachments = [];
 
-        foreach ($parser->getAttachments() as $attachment) {
-            $this->attachments[] = [
-              'stream' => base64_encode(stream_get_contents($attachment->getStream())),
-              'file_name' => base64_encode($attachment->getFileName()),
-              'mime' => base64_encode($attachment->getContentType())
-          ];
+        if ($parser->getParts()[1]['content-type'] === 'multipart/encrypted') {
+            $this->encryptedParts = $parser->getAttachments();
+        } else {
+            foreach ($parser->getAttachments() as $attachment) {
+                $this->attachments[] = [
+                  'stream' => base64_encode(stream_get_contents($attachment->getStream())),
+                  'file_name' => base64_encode($attachment->getFileName()),
+                  'mime' => base64_encode($attachment->getContentType())
+              ];
+            }
         }
     }
 }

+ 74 - 0
app/Helpers/AlreadyEncryptedSigner.php

@@ -0,0 +1,74 @@
+<?php
+
+namespace App\Helpers;
+
+use Swift_DependencyContainer;
+use Swift_Message;
+use Swift_Signers_BodySigner;
+use Swift_SwiftException;
+
+class AlreadyEncryptedSigner implements Swift_Signers_BodySigner
+{
+    protected $attachments;
+
+    public function __construct($attachments)
+    {
+        $this->attachments = $attachments;
+    }
+
+    /**
+     * @param Swift_Message $message
+     *
+     * @return $this
+     *
+     * @throws Swift_DependencyException
+     * @throws Swift_SwiftException
+     */
+    public function signMessage(Swift_Message $message)
+    {
+        $message->setChildren([]);
+
+        $message->setEncoder(Swift_DependencyContainer::getInstance()->lookup('mime.rawcontentencoder'));
+
+        $type = $message->getHeaders()->get('Content-Type');
+
+        $type->setValue('multipart/encrypted');
+
+        $type->setParameters([
+            'protocol' => 'application/pgp-encrypted',
+            'boundary' => $message->getBoundary()
+        ]);
+
+        $body = 'This is an OpenPGP/MIME encrypted message (RFC 4880 and 3156)' . PHP_EOL;
+
+        foreach ($this->attachments as $attachment) {
+            $body .= '--' . $message->getBoundary() . PHP_EOL;
+            $body .= $attachment->getMimePartStr() . PHP_EOL;
+        }
+
+        $body .= '--'. $message->getBoundary() . '--';
+
+        $message->setBody($body);
+
+        $messageHeaders = $message->getHeaders();
+        $messageHeaders->removeAll('Content-Transfer-Encoding');
+
+        return $this;
+    }
+
+    /**
+     * @return array
+     */
+    public function getAlteredHeaders()
+    {
+        return ['Content-Type', 'Content-Transfer-Encoding', 'Content-Disposition', 'Content-Description'];
+    }
+
+    /**
+     * @return $this
+     */
+    public function reset()
+    {
+        return $this;
+    }
+}

+ 0 - 59
app/Helpers/CustomMailer.php

@@ -1,59 +0,0 @@
-<?php
-
-namespace App\Helpers;
-
-use Illuminate\Contracts\Mail\Mailable as MailableContract;
-
-class CustomMailer extends \Illuminate\Mail\Mailer
-{
-    /**
-     * Send a new message using a view.
-     *
-     * @param  \Illuminate\Contracts\Mail\Mailable|string|array  $view
-     * @param  array  $data
-     * @param  \Closure|string|null  $callback
-     * @return void
-     */
-    public function send($view, array $data = [], $callback = null)
-    {
-        if ($view instanceof MailableContract) {
-            return $this->sendMailable($view);
-        }
-
-        // First we need to parse the view, which could either be a string or an array
-        // containing both an HTML and plain text versions of the view which should
-        // be used when sending an e-mail. We will extract both of them out here.
-        if ($view) {
-            [$view, $plain, $raw] = $this->parseView($view);
-        }
-
-        $data['message'] = $message = $this->createMessage();
-
-        // Once we have retrieved the view content for the e-mail we will set the body
-        // of this message using the HTML type, which will provide a simple wrapper
-        // to creating view based emails that are able to receive arrays of data.
-        $callback($message);
-
-        if ($view) {
-            $this->addContent($message, $view, $plain, $raw, $data);
-        }
-
-        // If a global "to" address has been set, we will set that address on the mail
-        // message. This is primarily useful during local development in which each
-        // message should be delivered into a single mail address for inspection.
-        if (isset($this->to['address'])) {
-            $this->setGlobalToAndRemoveCcAndBcc($message);
-        }
-
-        // Next we will determine if the message should be sent. We give the developer
-        // one final chance to stop this message and then we will send it to all of
-        // its recipients. We will then fire the sent event for the sent message.
-        $swiftMessage = $message->getSwiftMessage();
-
-        if ($this->shouldSendMessage($swiftMessage, $data)) {
-            $this->sendSwiftMessage($swiftMessage);
-
-            $this->dispatchSentEvent($message, $data);
-        }
-    }
-}

+ 10 - 1
app/Mail/ForwardEmail.php

@@ -4,6 +4,7 @@ namespace App\Mail;
 
 use App\Alias;
 use App\EmailData;
+use App\Helpers\AlreadyEncryptedSigner;
 use App\Helpers\OpenPGPSigner;
 use App\Notifications\GpgKeyExpired;
 use App\Recipient;
@@ -34,6 +35,7 @@ class ForwardEmail extends Mailable implements ShouldQueue
     protected $fingerprint;
     protected $openpgpsigner;
     protected $dkimSigner;
+    protected $encryptedParts;
 
     /**
      * Create a new message instance.
@@ -42,7 +44,8 @@ class ForwardEmail extends Mailable implements ShouldQueue
      */
     public function __construct(Alias $alias, EmailData $emailData, Recipient $recipient)
     {
-        $fingerprint = $recipient->should_encrypt ? $recipient->fingerprint : null;
+        $this->encryptedParts = $emailData->encryptedParts ?? null;
+        $fingerprint = $recipient->should_encrypt && !$this->encryptedParts ? $recipient->fingerprint : null;
 
         $this->user = $alias->user;
         $this->alias = $alias;
@@ -120,6 +123,12 @@ class ForwardEmail extends Mailable implements ShouldQueue
 
                 $message->setId(bin2hex(random_bytes(16)).'@'.$this->alias->domain);
 
+                if ($this->encryptedParts) {
+                    $alreadyEncryptedSigner = new AlreadyEncryptedSigner($this->encryptedParts);
+
+                    $message->attachSigner($alreadyEncryptedSigner);
+                }
+
                 if ($this->openpgpsigner) {
                     $message->attachSigner($this->openpgpsigner);
                 } elseif ($this->dkimSigner) { // TODO fix issue with failing DKIM signature if message is encrypted

+ 8 - 7
app/Mail/ReplyToEmail.php

@@ -22,6 +22,7 @@ class ReplyToEmail extends Mailable implements ShouldQueue
     protected $emailHtml;
     protected $emailAttachments;
     protected $dkimSigner;
+    protected $encryptedParts;
 
     /**
      * Create a new message instance.
@@ -36,6 +37,7 @@ class ReplyToEmail extends Mailable implements ShouldQueue
         $this->emailText = $emailData->text;
         $this->emailHtml = $emailData->html;
         $this->emailAttachments = $emailData->attachments;
+        $this->encryptedParts = $emailData->encryptedParts ?? null;
     }
 
     /**
@@ -75,6 +77,12 @@ class ReplyToEmail extends Mailable implements ShouldQueue
 
                 $message->setId(bin2hex(random_bytes(16)).'@'.$this->alias->domain);
 
+                if ($this->encryptedParts) {
+                    $alreadyEncryptedSigner = new AlreadyEncryptedSigner($this->encryptedParts);
+
+                    $message->attachSigner($alreadyEncryptedSigner);
+                }
+
                 if ($this->dkimSigner) {
                     $message->attachSigner($this->dkimSigner);
                 }
@@ -84,13 +92,6 @@ class ReplyToEmail extends Mailable implements ShouldQueue
             $email->replyTo($this->alias->email, $fromName);
         }
 
-        // TODO fix issue with replies that are already encrypted.
-        /* if ($this->emailText) {
-            $email->text('emails.reply.text')->with([
-                'text' => base64_decode($this->emailText)
-            ]);
-        } */
-
         if ($this->emailHtml) {
             $email->view('emails.reply.html')->with([
                 'html' => base64_decode($this->emailHtml)

+ 9 - 0
app/Mail/SendFromEmail.php

@@ -4,6 +4,7 @@ namespace App\Mail;
 
 use App\Alias;
 use App\EmailData;
+use App\Helpers\AlreadyEncryptedSigner;
 use App\User;
 use Illuminate\Bus\Queueable;
 use Illuminate\Contracts\Queue\ShouldQueue;
@@ -22,6 +23,7 @@ class SendFromEmail extends Mailable implements ShouldQueue
     protected $emailHtml;
     protected $emailAttachments;
     protected $dkimSigner;
+    protected $encryptedParts;
 
     /**
      * Create a new message instance.
@@ -36,6 +38,7 @@ class SendFromEmail extends Mailable implements ShouldQueue
         $this->emailText = $emailData->text;
         $this->emailHtml = $emailData->html;
         $this->emailAttachments = $emailData->attachments;
+        $this->encryptedParts = $emailData->encryptedParts ?? null;
     }
 
     /**
@@ -75,6 +78,12 @@ class SendFromEmail extends Mailable implements ShouldQueue
 
                 $message->setId(bin2hex(random_bytes(16)).'@'.$this->alias->domain);
 
+                if ($this->encryptedParts) {
+                    $alreadyEncryptedSigner = new AlreadyEncryptedSigner($this->encryptedParts);
+
+                    $message->attachSigner($alreadyEncryptedSigner);
+                }
+
                 if ($this->dkimSigner) {
                     $message->attachSigner($this->dkimSigner);
                 }

+ 0 - 43
app/Providers/CustomMailServiceProvider.php

@@ -1,43 +0,0 @@
-<?php
-
-namespace App\Providers;
-
-use App\Helpers\CustomMailer;
-use Illuminate\Mail\MailServiceProvider;
-
-class CustomMailServiceProvider extends MailServiceProvider
-{
-    /**
-     * Register the Illuminate mailer instance.
-     *
-     * @return void
-     */
-    protected function registerIlluminateMailer()
-    {
-        $this->app->singleton('mailer', function ($app) {
-            $config = $app->make('config')->get('mail');
-
-            // Once we have create the mailer instance, we will set a container instance
-            // on the mailer. This allows us to resolve mailer classes via containers
-            // for maximum testability on said classes instead of passing Closures.
-            $mailer = new CustomMailer(
-                $app['view'],
-                $app['swift.mailer'],
-                $app['events']
-            );
-
-            if ($app->bound('queue')) {
-                $mailer->setQueue($app['queue']);
-            }
-
-            // Next we will set all of the global addresses on this mailer, which allows
-            // for easy unification of all "from" addresses as well as easy debugging
-            // of sent messages since they get be sent into a single email address.
-            foreach (['from', 'reply_to', 'to'] as $type) {
-                $this->setGlobalAddress($mailer, $config, $type);
-            }
-
-            return $mailer;
-        });
-    }
-}

+ 81 - 147
composer.lock

@@ -628,16 +628,16 @@
         },
         {
             "name": "egulias/email-validator",
-            "version": "2.1.15",
+            "version": "2.1.17",
             "source": {
                 "type": "git",
                 "url": "https://github.com/egulias/EmailValidator.git",
-                "reference": "e834eea5306d85d67de5a05db5882911d5b29357"
+                "reference": "ade6887fd9bd74177769645ab5c474824f8a418a"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/e834eea5306d85d67de5a05db5882911d5b29357",
-                "reference": "e834eea5306d85d67de5a05db5882911d5b29357",
+                "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/ade6887fd9bd74177769645ab5c474824f8a418a",
+                "reference": "ade6887fd9bd74177769645ab5c474824f8a418a",
                 "shasum": ""
             },
             "require": {
@@ -682,7 +682,7 @@
                 "validation",
                 "validator"
             ],
-            "time": "2020-01-20T21:40:59+00:00"
+            "time": "2020-02-13T22:36:52+00:00"
         },
         {
             "name": "fideloper/proxy",
@@ -1269,16 +1269,16 @@
         },
         {
             "name": "laravel/framework",
-            "version": "v6.14.0",
+            "version": "v6.15.1",
             "source": {
                 "type": "git",
                 "url": "https://github.com/laravel/framework.git",
-                "reference": "9e78f1aeb2c60bd7badcbafc352a9a2c5863c60c"
+                "reference": "b7c152e3327c03428fb68d5abb63ca8b3eca8422"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/laravel/framework/zipball/9e78f1aeb2c60bd7badcbafc352a9a2c5863c60c",
-                "reference": "9e78f1aeb2c60bd7badcbafc352a9a2c5863c60c",
+                "url": "https://api.github.com/repos/laravel/framework/zipball/b7c152e3327c03428fb68d5abb63ca8b3eca8422",
+                "reference": "b7c152e3327c03428fb68d5abb63ca8b3eca8422",
                 "shasum": ""
             },
             "require": {
@@ -1288,8 +1288,7 @@
                 "ext-json": "*",
                 "ext-mbstring": "*",
                 "ext-openssl": "*",
-                "league/commonmark": "^1.1",
-                "league/commonmark-ext-table": "^2.1",
+                "league/commonmark": "^1.3",
                 "league/flysystem": "^1.0.8",
                 "monolog/monolog": "^1.12|^2.0",
                 "nesbot/carbon": "^2.0",
@@ -1412,20 +1411,20 @@
                 "framework",
                 "laravel"
             ],
-            "time": "2020-02-04T14:38:06+00:00"
+            "time": "2020-02-12T21:56:14+00:00"
         },
         {
             "name": "laravel/passport",
-            "version": "v8.3.1",
+            "version": "v8.4.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/laravel/passport.git",
-                "reference": "98456cb16efd2ef7b41797e0a8559c9d8b4112f8"
+                "reference": "c1be259ff85109416e9e81c80fa4d3d611d6398a"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/laravel/passport/zipball/98456cb16efd2ef7b41797e0a8559c9d8b4112f8",
-                "reference": "98456cb16efd2ef7b41797e0a8559c9d8b4112f8",
+                "url": "https://api.github.com/repos/laravel/passport/zipball/c1be259ff85109416e9e81c80fa4d3d611d6398a",
+                "reference": "c1be259ff85109416e9e81c80fa4d3d611d6398a",
                 "shasum": ""
             },
             "require": {
@@ -1484,7 +1483,7 @@
                 "oauth",
                 "passport"
             ],
-            "time": "2020-01-29T13:25:24+00:00"
+            "time": "2020-02-12T14:34:02+00:00"
         },
         {
             "name": "laravel/tinker",
@@ -1678,71 +1677,6 @@
             ],
             "time": "2020-02-08T23:42:03+00:00"
         },
-        {
-            "name": "league/commonmark-ext-table",
-            "version": "v2.1.0",
-            "source": {
-                "type": "git",
-                "url": "https://github.com/thephpleague/commonmark-ext-table.git",
-                "reference": "3228888ea69636e855efcf6636ff8e6316933fe7"
-            },
-            "dist": {
-                "type": "zip",
-                "url": "https://api.github.com/repos/thephpleague/commonmark-ext-table/zipball/3228888ea69636e855efcf6636ff8e6316933fe7",
-                "reference": "3228888ea69636e855efcf6636ff8e6316933fe7",
-                "shasum": ""
-            },
-            "require": {
-                "league/commonmark": "~0.19.3|^1.0",
-                "php": "^7.1"
-            },
-            "require-dev": {
-                "friendsofphp/php-cs-fixer": "^2.14",
-                "phpstan/phpstan": "~0.11",
-                "phpunit/phpunit": "^7.0|^8.0",
-                "symfony/var-dumper": "^4.0",
-                "vimeo/psalm": "^3.0"
-            },
-            "type": "commonmark-extension",
-            "extra": {
-                "branch-alias": {
-                    "dev-master": "2.2-dev"
-                }
-            },
-            "autoload": {
-                "psr-4": {
-                    "League\\CommonMark\\Ext\\Table\\": "src"
-                }
-            },
-            "notification-url": "https://packagist.org/downloads/",
-            "license": [
-                "MIT"
-            ],
-            "authors": [
-                {
-                    "name": "Martin Hasoň",
-                    "email": "martin.hason@gmail.com"
-                },
-                {
-                    "name": "Webuni s.r.o.",
-                    "homepage": "https://www.webuni.cz"
-                },
-                {
-                    "name": "Colin O'Dell",
-                    "email": "colinodell@gmail.com",
-                    "homepage": "https://www.colinodell.com"
-                }
-            ],
-            "description": "Table extension for league/commonmark",
-            "homepage": "https://github.com/thephpleague/commonmark-ext-table",
-            "keywords": [
-                "commonmark",
-                "extension",
-                "markdown",
-                "table"
-            ],
-            "time": "2019-09-26T13:28:33+00:00"
-        },
         {
             "name": "league/event",
             "version": "2.2.0",
@@ -2106,16 +2040,16 @@
         },
         {
             "name": "nesbot/carbon",
-            "version": "2.29.1",
+            "version": "2.30.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/briannesbitt/Carbon.git",
-                "reference": "e509be5bf2d703390e69e14496d9a1168452b0a2"
+                "reference": "912dff66d2690ca66abddb9b291a1df5f371d3b4"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/e509be5bf2d703390e69e14496d9a1168452b0a2",
-                "reference": "e509be5bf2d703390e69e14496d9a1168452b0a2",
+                "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/912dff66d2690ca66abddb9b291a1df5f371d3b4",
+                "reference": "912dff66d2690ca66abddb9b291a1df5f371d3b4",
                 "shasum": ""
             },
             "require": {
@@ -2172,7 +2106,7 @@
                 "datetime",
                 "time"
             ],
-            "time": "2020-01-21T09:36:43+00:00"
+            "time": "2020-02-07T15:25:46+00:00"
         },
         {
             "name": "nikic/php-parser",
@@ -3994,16 +3928,16 @@
         },
         {
             "name": "symfony/polyfill-ctype",
-            "version": "v1.13.1",
+            "version": "v1.14.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/polyfill-ctype.git",
-                "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3"
+                "reference": "fbdeaec0df06cf3d51c93de80c7eb76e271f5a38"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f8f0b461be3385e56d6de3dbb5a0df24c0c275e3",
-                "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3",
+                "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/fbdeaec0df06cf3d51c93de80c7eb76e271f5a38",
+                "reference": "fbdeaec0df06cf3d51c93de80c7eb76e271f5a38",
                 "shasum": ""
             },
             "require": {
@@ -4015,7 +3949,7 @@
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-master": "1.13-dev"
+                    "dev-master": "1.14-dev"
                 }
             },
             "autoload": {
@@ -4048,20 +3982,20 @@
                 "polyfill",
                 "portable"
             ],
-            "time": "2019-11-27T13:56:44+00:00"
+            "time": "2020-01-13T11:15:53+00:00"
         },
         {
             "name": "symfony/polyfill-iconv",
-            "version": "v1.13.1",
+            "version": "v1.14.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/polyfill-iconv.git",
-                "reference": "a019efccc03f1a335af6b4f20c30f5ea8060be36"
+                "reference": "926832ce51059bb58211b7b2080a88e0c3b5328e"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/a019efccc03f1a335af6b4f20c30f5ea8060be36",
-                "reference": "a019efccc03f1a335af6b4f20c30f5ea8060be36",
+                "url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/926832ce51059bb58211b7b2080a88e0c3b5328e",
+                "reference": "926832ce51059bb58211b7b2080a88e0c3b5328e",
                 "shasum": ""
             },
             "require": {
@@ -4073,7 +4007,7 @@
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-master": "1.13-dev"
+                    "dev-master": "1.14-dev"
                 }
             },
             "autoload": {
@@ -4107,26 +4041,26 @@
                 "portable",
                 "shim"
             ],
-            "time": "2019-11-27T13:56:44+00:00"
+            "time": "2020-01-13T11:15:53+00:00"
         },
         {
             "name": "symfony/polyfill-intl-idn",
-            "version": "v1.13.1",
+            "version": "v1.14.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/polyfill-intl-idn.git",
-                "reference": "6f9c239e61e1b0c9229a28ff89a812dc449c3d46"
+                "reference": "6842f1a39cf7d580655688069a03dd7cd83d244a"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/6f9c239e61e1b0c9229a28ff89a812dc449c3d46",
-                "reference": "6f9c239e61e1b0c9229a28ff89a812dc449c3d46",
+                "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/6842f1a39cf7d580655688069a03dd7cd83d244a",
+                "reference": "6842f1a39cf7d580655688069a03dd7cd83d244a",
                 "shasum": ""
             },
             "require": {
                 "php": ">=5.3.3",
                 "symfony/polyfill-mbstring": "^1.3",
-                "symfony/polyfill-php72": "^1.9"
+                "symfony/polyfill-php72": "^1.10"
             },
             "suggest": {
                 "ext-intl": "For best performance"
@@ -4134,7 +4068,7 @@
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-master": "1.13-dev"
+                    "dev-master": "1.14-dev"
                 }
             },
             "autoload": {
@@ -4169,20 +4103,20 @@
                 "portable",
                 "shim"
             ],
-            "time": "2019-11-27T13:56:44+00:00"
+            "time": "2020-01-17T12:01:36+00:00"
         },
         {
             "name": "symfony/polyfill-mbstring",
-            "version": "v1.13.1",
+            "version": "v1.14.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/polyfill-mbstring.git",
-                "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f"
+                "reference": "34094cfa9abe1f0f14f48f490772db7a775559f2"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7b4aab9743c30be783b73de055d24a39cf4b954f",
-                "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f",
+                "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/34094cfa9abe1f0f14f48f490772db7a775559f2",
+                "reference": "34094cfa9abe1f0f14f48f490772db7a775559f2",
                 "shasum": ""
             },
             "require": {
@@ -4194,7 +4128,7 @@
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-master": "1.13-dev"
+                    "dev-master": "1.14-dev"
                 }
             },
             "autoload": {
@@ -4228,20 +4162,20 @@
                 "portable",
                 "shim"
             ],
-            "time": "2019-11-27T14:18:11+00:00"
+            "time": "2020-01-13T11:15:53+00:00"
         },
         {
             "name": "symfony/polyfill-php56",
-            "version": "v1.13.1",
+            "version": "v1.14.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/polyfill-php56.git",
-                "reference": "53dd1cdf3cb986893ccf2b96665b25b3abb384f4"
+                "reference": "16ec91cb06998b609501b55b7177b7d7c02badb3"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/polyfill-php56/zipball/53dd1cdf3cb986893ccf2b96665b25b3abb384f4",
-                "reference": "53dd1cdf3cb986893ccf2b96665b25b3abb384f4",
+                "url": "https://api.github.com/repos/symfony/polyfill-php56/zipball/16ec91cb06998b609501b55b7177b7d7c02badb3",
+                "reference": "16ec91cb06998b609501b55b7177b7d7c02badb3",
                 "shasum": ""
             },
             "require": {
@@ -4251,7 +4185,7 @@
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-master": "1.13-dev"
+                    "dev-master": "1.14-dev"
                 }
             },
             "autoload": {
@@ -4284,20 +4218,20 @@
                 "portable",
                 "shim"
             ],
-            "time": "2019-11-27T13:56:44+00:00"
+            "time": "2020-01-13T11:15:53+00:00"
         },
         {
             "name": "symfony/polyfill-php72",
-            "version": "v1.13.1",
+            "version": "v1.14.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/polyfill-php72.git",
-                "reference": "66fea50f6cb37a35eea048d75a7d99a45b586038"
+                "reference": "46ecacf4751dd0dc81e4f6bf01dbf9da1dc1dadf"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/66fea50f6cb37a35eea048d75a7d99a45b586038",
-                "reference": "66fea50f6cb37a35eea048d75a7d99a45b586038",
+                "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/46ecacf4751dd0dc81e4f6bf01dbf9da1dc1dadf",
+                "reference": "46ecacf4751dd0dc81e4f6bf01dbf9da1dc1dadf",
                 "shasum": ""
             },
             "require": {
@@ -4306,7 +4240,7 @@
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-master": "1.13-dev"
+                    "dev-master": "1.14-dev"
                 }
             },
             "autoload": {
@@ -4339,20 +4273,20 @@
                 "portable",
                 "shim"
             ],
-            "time": "2019-11-27T13:56:44+00:00"
+            "time": "2020-01-13T11:15:53+00:00"
         },
         {
             "name": "symfony/polyfill-php73",
-            "version": "v1.13.1",
+            "version": "v1.14.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/polyfill-php73.git",
-                "reference": "4b0e2222c55a25b4541305a053013d5647d3a25f"
+                "reference": "5e66a0fa1070bf46bec4bea7962d285108edd675"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/4b0e2222c55a25b4541305a053013d5647d3a25f",
-                "reference": "4b0e2222c55a25b4541305a053013d5647d3a25f",
+                "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/5e66a0fa1070bf46bec4bea7962d285108edd675",
+                "reference": "5e66a0fa1070bf46bec4bea7962d285108edd675",
                 "shasum": ""
             },
             "require": {
@@ -4361,7 +4295,7 @@
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-master": "1.13-dev"
+                    "dev-master": "1.14-dev"
                 }
             },
             "autoload": {
@@ -4397,20 +4331,20 @@
                 "portable",
                 "shim"
             ],
-            "time": "2019-11-27T16:25:15+00:00"
+            "time": "2020-01-13T11:15:53+00:00"
         },
         {
             "name": "symfony/polyfill-util",
-            "version": "v1.13.1",
+            "version": "v1.14.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/polyfill-util.git",
-                "reference": "964a67f293b66b95883a5ed918a65354fcd2258f"
+                "reference": "ba3cfcea6d0192cae46c62041f61cbb704b526d3"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/polyfill-util/zipball/964a67f293b66b95883a5ed918a65354fcd2258f",
-                "reference": "964a67f293b66b95883a5ed918a65354fcd2258f",
+                "url": "https://api.github.com/repos/symfony/polyfill-util/zipball/ba3cfcea6d0192cae46c62041f61cbb704b526d3",
+                "reference": "ba3cfcea6d0192cae46c62041f61cbb704b526d3",
                 "shasum": ""
             },
             "require": {
@@ -4419,7 +4353,7 @@
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-master": "1.13-dev"
+                    "dev-master": "1.14-dev"
                 }
             },
             "autoload": {
@@ -4449,7 +4383,7 @@
                 "polyfill",
                 "shim"
             ],
-            "time": "2019-11-27T13:56:44+00:00"
+            "time": "2020-01-13T11:15:53+00:00"
         },
         {
             "name": "symfony/process",
@@ -7392,16 +7326,16 @@
         },
         {
             "name": "symfony/polyfill-php70",
-            "version": "v1.13.1",
+            "version": "v1.14.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/polyfill-php70.git",
-                "reference": "af23c7bb26a73b850840823662dda371484926c4"
+                "reference": "419c4940024c30ccc033650373a1fe13890d3255"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/af23c7bb26a73b850840823662dda371484926c4",
-                "reference": "af23c7bb26a73b850840823662dda371484926c4",
+                "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/419c4940024c30ccc033650373a1fe13890d3255",
+                "reference": "419c4940024c30ccc033650373a1fe13890d3255",
                 "shasum": ""
             },
             "require": {
@@ -7411,7 +7345,7 @@
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-master": "1.13-dev"
+                    "dev-master": "1.14-dev"
                 }
             },
             "autoload": {
@@ -7447,7 +7381,7 @@
                 "portable",
                 "shim"
             ],
-            "time": "2019-11-27T13:56:44+00:00"
+            "time": "2020-01-13T11:15:53+00:00"
         },
         {
             "name": "symfony/stopwatch",
@@ -7541,16 +7475,16 @@
         },
         {
             "name": "webmozart/assert",
-            "version": "1.6.0",
+            "version": "1.7.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/webmozart/assert.git",
-                "reference": "573381c0a64f155a0d9a23f4b0c797194805b925"
+                "reference": "aed98a490f9a8f78468232db345ab9cf606cf598"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/webmozart/assert/zipball/573381c0a64f155a0d9a23f4b0c797194805b925",
-                "reference": "573381c0a64f155a0d9a23f4b0c797194805b925",
+                "url": "https://api.github.com/repos/webmozart/assert/zipball/aed98a490f9a8f78468232db345ab9cf606cf598",
+                "reference": "aed98a490f9a8f78468232db345ab9cf606cf598",
                 "shasum": ""
             },
             "require": {
@@ -7585,7 +7519,7 @@
                 "check",
                 "validate"
             ],
-            "time": "2019-11-24T13:36:37+00:00"
+            "time": "2020-02-14T12:15:55+00:00"
         }
     ],
     "aliases": [],

+ 0 - 1
config/app.php

@@ -175,7 +175,6 @@ return [
         App\Providers\EventServiceProvider::class,
         App\Providers\RouteServiceProvider::class,
         App\Providers\HelperServiceProvider::class,
-        App\Providers\CustomMailServiceProvider::class,
 
     ],
 

+ 34 - 34
tests/emails/email_reply_encrypted.eml

@@ -1,6 +1,6 @@
 Date: Wed, 20 Feb 2019 15:00:00 +0100 (CET)
 From: Will <will@anonaddy.com>
-To: contact@ebay.com <ebay+b2498b76d8686bf4f48d034fbada4de6f585e2aa@johndoe.anonaddy.com>
+To: <ebay+contact=ebay.com@johndoe.anonaddy.com>
 Subject: RE: Test Email
 In-Reply-To: <9f2ada5308f1a3f88515a370504a66b3@swift.generated>
 Content-Type: multipart/encrypted; protocol="application/pgp-encrypted"; boundary="----=_Part_10031_1199410393.1550677940425"
@@ -19,39 +19,39 @@ Content-Disposition: inline; filename="encrypted.asc"
 
 -----BEGIN PGP MESSAGE-----
 
-hQGMA61U1XgYVZGqAQwAwsZnzUWMqibcgyAemgMU+vGl6v9fHt/HNz0cYH9Hve0F
-geE57J7oEkujnA47numZ4/MxvV0Q+0OVc0ZNcZ9Ghah8AWHZ5p6Q838fDy2Iw7L4
-KOl1hT1u6h9t0cZxXWW2CqjAITYsIk/zIVcHZa+qWSq2mr8HYTAo7dlqq/Mn5Zss
-OFWKsNXzFGEkIP9w3HLiRxuE7CEeY/oDZFnZKXFalTye8XNK43ioujEPGc3v5ImX
-8ZW2C1TIy319qpMXJ3/CE7rbbq808cT5qD0V9c92/LDrBK/3liMStmYBryPexWx2
-svv3dbZqNXPY4WonSM5kg99vDv96TiHbGKwL2Wnjm6tKKmaGSOms0IQ+MCNlOvaq
-2+kfz1LAbdTdI6aWQ5xB08VyuowL8+3hUrNoIjxGDhD7ZzslAQ8WUo6i4jRwuUvD
-1IMhF+cj6zMg+c9CYpUBo6vVYFDHAi+wQKxqmjaZvSeiOLvsGu2bDxFIrjdrbSi0
-M0TByqjDciEQCMiqD+YqhQGMA0sUUxmvUIjDAQv/b111j2sXLZVbtHYOIDRkzSCo
-gbHrHo+D5YF6zsnt5tLc/w0IXeWEXkPsyWwlxMMBjdJREDrhjye0LpFf65bVkYc9
-KF0sdljpAnoW4PkmdqpiBY5D2JPRZxvLoFgYsnZJCnDNXE27909sPmewid8gsI4C
-GRe6jhfcX8NqQN0DN6TMRhLtFa+2RHf2s/aQa1jLtYSJ30sXNRjP6G+q7dHbGAst
-l0H2qNJVTuvQDsBv+AFsBw0YuR0fyirwCMjovDRp9Da6MpefplUmZ7qElxCJdUwI
-1g2IUwC1OkJExgShf54IMSPoJ+Uiaj/yAD+d/3dpEbSvqudzmnWQTtqsMdoMELhj
-2NoWqhUZbqEzJdNQN4VlXKtkzYY8LM9mdy9DIJvaV1GaGt1r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