diff --git a/app/Mail/Forms/SubmissionConfirmationMail.php b/app/Mail/Forms/SubmissionConfirmationMail.php index 9c2f30e..4ea01a3 100644 --- a/app/Mail/Forms/SubmissionConfirmationMail.php +++ b/app/Mail/Forms/SubmissionConfirmationMail.php @@ -9,6 +9,7 @@ use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Queue\SerializesModels; use Illuminate\Support\Str; +use Illuminate\Support\Arr; class SubmissionConfirmationMail extends OpenFormMail implements ShouldQueue { @@ -36,7 +37,7 @@ class SubmissionConfirmationMail extends OpenFormMail implements ShouldQueue ->outputStringsOnly(); return $this - ->replyTo($form->creator->email) + ->replyTo($this->getReplyToEmail($form->creator->email)) ->from($this->getFromEmail(), $form->notification_sender) ->subject($form->notification_subject) ->markdown('mail.form.confirmation-submission-notification',[ @@ -52,4 +53,10 @@ class SubmissionConfirmationMail extends OpenFormMail implements ShouldQueue $originalFromAddress = Str::of(config('mail.from.address'))->explode('@'); return $originalFromAddress->first(). '+' . time() . '@' . $originalFromAddress->last(); } + + private function getReplyToEmail($default) + { + $replyTo = Arr::get((array)$this->event->form->notification_settings, 'confirmation_reply_to', null); + return $replyTo ?? $default; + } } diff --git a/app/Notifications/Forms/FormSubmissionNotification.php b/app/Notifications/Forms/FormSubmissionNotification.php index d5dabf4..94196e3 100644 --- a/app/Notifications/Forms/FormSubmissionNotification.php +++ b/app/Notifications/Forms/FormSubmissionNotification.php @@ -9,6 +9,7 @@ use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Notifications\Notification; use Illuminate\Support\Str; +use Illuminate\Support\Arr; class FormSubmissionNotification extends Notification implements ShouldQueue { @@ -68,6 +69,10 @@ class FormSubmissionNotification extends Notification implements ShouldQueue private function getReplyToEmail($default) { + $replyTo = Arr::get((array)$this->event->form->notification_settings, 'notification_reply_to', null); + if ($replyTo && $this->validateEmail($replyTo)) { + return $replyTo; + } return $this->getRespondentEmail() ?? $default; } diff --git a/resources/js/components/open/forms/components/form-components/FormNotifications.vue b/resources/js/components/open/forms/components/form-components/FormNotifications.vue index b8f620e..03d813d 100644 --- a/resources/js/components/open/forms/components/form-components/FormNotifications.vue +++ b/resources/js/components/open/forms/components/form-components/FormNotifications.vue @@ -13,9 +13,9 @@ + - diff --git a/resources/js/components/open/forms/components/form-components/components/FormNotificationsOption.vue b/resources/js/components/open/forms/components/form-components/components/FormNotificationsOption.vue index d5ee531..df478c4 100644 --- a/resources/js/components/open/forms/components/form-components/components/FormNotificationsOption.vue +++ b/resources/js/components/open/forms/components/form-components/components/FormNotificationsOption.vue @@ -33,11 +33,18 @@ - + @@ -73,9 +80,9 @@ export default { }, notifiesHelp () { if (this.replayToEmailField) { - return 'Reply-to for this notification will be the email filled in the field "' + this.replayToEmailField.name + '".' + return 'If empty, Reply-to for this notification will be the email filled in the field "' + this.replayToEmailField.name + '".' } - return 'Reply-to for this notification will be your own email. Add a single email field to your form, and it will automatically become the reply to value.' + return 'If empty, Reply-to for this notification will be your own email. Add a single email field to your form, and it will automatically become the reply to value.' } }, diff --git a/resources/js/components/open/forms/components/form-components/components/FormNotificationsSubmissionConfirmation.vue b/resources/js/components/open/forms/components/form-components/components/FormNotificationsSubmissionConfirmation.vue index 0c7fc41..87e7d58 100644 --- a/resources/js/components/open/forms/components/form-components/components/FormNotificationsSubmissionConfirmation.vue +++ b/resources/js/components/open/forms/components/form-components/components/FormNotificationsSubmissionConfirmation.vue @@ -31,22 +31,32 @@ :form="form" class="mt-4" label="Send submission confirmation" :help="emailSubmissionConfirmationHelp" /> - - - - + diff --git a/resources/views/mail/form/confirmation-submission-notification.blade.php b/resources/views/mail/form/confirmation-submission-notification.blade.php index e1d36d8..e77c1db 100644 --- a/resources/views/mail/form/confirmation-submission-notification.blade.php +++ b/resources/views/mail/form/confirmation-submission-notification.blade.php @@ -4,7 +4,7 @@ @if($form->editable_submissions) @component('mail::button', ['url' => $form->share_url.'?submission_id='.$submission_id]) -{{$form.editable_submissions_button_text}} +{{($form->editable_submissions_button_text ?? 'Edit submission')}} @endcomponent @endif