senderOptions->listSenders(); return response()->json([ 'ok' => true, 'senders' => EmailSenderResource::collection($senders), ]); } public function send(EmailSendRequest $request): JsonResponse { $payload = $request->validated(); $attachments = $this->attachments->normalize($request->file('attachments', [])); $ok = $this->dispatch->send( $payload['recipient'], $payload['subject'], $payload['html_message'], $payload['profile'] ?? null, $payload['reply_to_email'] ?? null, $payload['reply_to_name'] ?? null, $attachments ); if (! $ok) { return response()->json([ 'ok' => false, 'message' => 'Email failed to send.', ], 500); } return response()->json([ 'ok' => true, 'message' => 'Email sent successfully.', ]); } }