import { sendEmail } from "@/lib/mail.utils"

export async function POST() {
    const sender = {
        name: 'My App',
        address: 'no-reply@kevosattire.com',
    }

    const recipients = [{
        name: 'John Doe',
        address: 'fernando.delgado@kevosattire.com',
    }]

    try{
        const result = await sendEmail({
            sender,
            recipients,
            subject: "Thank you for placing an order with us!",
            message: "We will follow up with a Paypal invoice soon!"
        })

        return Response.json({
            accepted: result.accepted,
        })
    } catch (error){
        return Response.json({message: 'Unable to send email at this time.'}, {status: 500})
    }
}