diff --git a/app/Mail/SendContactMail.php b/app/Mail/SendContactMail.php
index 273cc17..53538f3 100644
--- a/app/Mail/SendContactMail.php
+++ b/app/Mail/SendContactMail.php
@@ -5,14 +5,11 @@ namespace App\Mail;
use App\Enums\Contact\ObjectEnum;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
+use Illuminate\Mail\Mailables\Address;
use Illuminate\Mail\Mailables\Attachment;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
-use Illuminate\Mail\Markdown;
use Illuminate\Queue\SerializesModels;
-use Illuminate\Support\Arr;
-use Illuminate\Support\Facades\Blade;
-use Illuminate\Support\Str;
class SendContactMail extends Mailable
{
@@ -34,33 +31,6 @@ class SendContactMail extends Mailable
public function __construct(\stdClass $data)
{
$this->data = clone $data;
- $this->sanitizeStringInputs();
- }
-
- /**
- * Sanitizes user message
- *
- * ! This is not recursive !
- * * Prevent xss injection via markdown interpretation.
- *
- * La solution devrai etre de filtrer en sortie, mais il n'est pas possible de
- *
- * @return void
- */
- private function sanitizeStringInputs(): void
- {
- $this->data = (object)Arr::map((array)$this->data, function ($el) {
- if (is_string($el)) {
- $el = \htmlspecialchars(\strip_tags(Blade::render(
- (string)Markdown::parse($el)
- )));
- $el = Str::of($el)->replaceMatches(
- '/[^\p{L}0-9\n\s\@\.\:\-\_\?\!\;\(\)\+\-\/\\\=]+/us',
- ''
- )->trim()->wordWrap(75, "\n", true)->toString();
- }
- return $el;
- });
}
/**
@@ -71,8 +41,13 @@ class SendContactMail extends Mailable
public function envelope(): \Illuminate\Mail\Mailables\Envelope
{
return new Envelope(
+ from: new Address(\config('mail.from.address'), \config('mail.from.name')),
subject: sprintf('%s - %s', ObjectEnum::make($this->data->type)->label() ??
__('Nouveau message'), config('app.name')),
+ replyTo: [new Address(
+ $this->data->email,
+ sprintf('%s %s', $this->data->first_name, $this->data->last_name)
+ )],
);
}
diff --git a/resources/views/emails/send-contact-form.blade.php b/resources/views/emails/send-contact-form.blade.php
index 4c32b75..6537c97 100644
--- a/resources/views/emails/send-contact-form.blade.php
+++ b/resources/views/emails/send-contact-form.blade.php
@@ -32,7 +32,7 @@
@component('mail::panel')
```
-{{ $data->message }}
+{!! $data->message !!}
```
@endcomponent
diff --git a/resources/views/vendor/mail/html/header.blade.php b/resources/views/vendor/mail/html/header.blade.php
index 920bc2d..a190024 100644
--- a/resources/views/vendor/mail/html/header.blade.php
+++ b/resources/views/vendor/mail/html/header.blade.php
@@ -2,11 +2,9 @@
diff --git a/resources/views/vendor/mail/html/panel.blade.php b/resources/views/vendor/mail/html/panel.blade.php
new file mode 100644
index 0000000..9dac36c
--- /dev/null
+++ b/resources/views/vendor/mail/html/panel.blade.php
@@ -0,0 +1,17 @@
+
+
+
+
+
+|
+{!! clean(nl2br(str($slot)->markdown([
+ 'html_input' => 'strip',
+ 'allow_unsafe_links' => false,
+]))) !!}
+ |
+
+
+ |
+
+
+