<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Mail;
use App\Mail\FormSubmissionMail;

class MailController extends Controller
{
    public function send(Request $request)
    {
        $fields = $request->all();

        Mail::to('recipient@example.com')->send(new FormSubmissionMail($fields));

        return response()->json(['message' => 'Email sent successfully']);
    }
}
