Переглянути джерело

Added encoding for subject and display to

Will Browning 5 роки тому
батько
коміт
4a78faeefd
3 змінених файлів з 6 додано та 6 видалено
  1. 2 2
      app/EmailData.php
  2. 3 3
      app/Mail/ForwardEmail.php
  3. 1 1
      app/Mail/ReplyToEmail.php

+ 2 - 2
app/EmailData.php

@@ -9,8 +9,8 @@ class EmailData
     public function __construct(Parser $parser)
     {
         $this->sender = $parser->getAddresses('from')[0]['address'];
-        $this->display_from = $parser->getAddresses('from')[0]['display'];
-        $this->subject = $parser->getHeader('subject');
+        $this->display_from = base64_encode($parser->getAddresses('from')[0]['display']);
+        $this->subject = base64_encode($parser->getHeader('subject'));
         $this->text = base64_encode($parser->getMessageBody('text'));
         $this->html = base64_encode($parser->getMessageBody('html'));
         $this->attachments = [];

+ 3 - 3
app/Mail/ForwardEmail.php

@@ -62,9 +62,9 @@ class ForwardEmail extends Mailable implements ShouldQueue
         $replyToEmail = $this->alias->local_part.'+'.sha1(config('anonaddy.secret').$this->sender).'@'.$this->alias->domain;
 
         $email =  $this
-            ->from(config('mail.from.address'), $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)
-            ->subject($this->user->email_subject ?? $this->emailSubject)
+            ->subject($this->user->email_subject ?? base64_decode($this->emailSubject))
             ->text('emails.forward.text')->with([
                 'text' => base64_decode($this->emailText)
             ])
@@ -73,7 +73,7 @@ class ForwardEmail extends Mailable implements ShouldQueue
                 'deactivateUrl' => $this->deactivateUrl,
                 'aliasEmail' => $this->alias->email,
                 'fromEmail' => $this->sender,
-                'replacedSubject' => $this->user->email_subject ? ' with subject "' . $this->emailSubject . '"' : null
+                'replacedSubject' => $this->user->email_subject ? ' with subject "' . base64_decode($this->emailSubject) . '"' : null
             ])
             ->withSwiftMessage(function ($message) {
                 $message->getHeaders()

+ 1 - 1
app/Mail/ReplyToEmail.php

@@ -48,7 +48,7 @@ class ReplyToEmail extends Mailable implements ShouldQueue
         $email =  $this
             ->from(config('mail.from.address'), $fromName)
             ->replyTo($this->alias->email, $fromName)
-            ->subject($this->emailSubject)
+            ->subject(base64_decode($this->emailSubject))
             ->text('emails.reply.text')->with([
                 'text' => base64_decode($this->emailText)
             ])