feat(contact): send confirmation email to form submitter
Deploy Backend / deploy (push) Successful in 47s
Deploy Backend / deploy (push) Successful in 47s
Keep admin notify to CONTACT_NOTIFY_TO and also mail the submitter a branded confirmation so testers are not confused by missing inbox mail.
This commit is contained in:
1 parent
1c8086bad1
commit
fa32df60a9
7 files changed
+168
-25
No files matched your search
@@ -3,6 +3,7 @@
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Mail\ContactMessageConfirmed;
|
||||
use App\Mail\ContactMessageReceived;
|
||||
use App\Models\ContactMessage;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
@@ -47,6 +48,15 @@ class ContactMessageController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
Mail::to($message->email)->send(new ContactMessageConfirmed($message));
|
||||
} catch (\Throwable $e) {
|
||||
Log::error('Contact form confirmation email failed', [
|
||||
'contact_message_id' => $message->id,
|
||||
'error' => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
|
||||
return response()->json(['message' => 'پیام شما با موفقیت ثبت شد.'], 201);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user