export async function load({ }) { console.log("shirt preorder page") } import { SMTP_USERNAME } from '$env/static/private' import { transporter } from "$lib/email" export const actions = { default: async ({ request }) => { let data = await request.formData(); // console.log("apply", data); let order = { name: data.get('name'), email: data.get('email'), amount: data.get('amount'), estimated_price: data.get('estimated_price'), } console.log("appl", order, data) const shirt_string = "test" // const shirt_string = [ // shirt.name, // shirt.city, // shirt.contact?.name, // ].map(v => { // // Escape for CSV safety // const s = String(v ?? ''); // return s.includes(',') || s.includes('"') ? `"${s.replace(/"/g, '""')}"` : s; // }).join(', '); console.log(shirt_string) // transporter.sendMail({ // from: SMTP_USERNAME, // to: "farm@sludge.link", // subject: "Sludge Farm Shirt Preorder", // attachments: [{ // filename: order.name + '-shirts.csv', // content: shirt_string // }, // { // filename: order.name + '-shirts.json', // content: JSON.stringify(order) // } // ], // html: ` // // // //

new order for ${order.name}!!

//
 ${JSON.stringify(order, null, 2).replace(/&/g, '&').replace(//g, '>')} 
// // { // if (error) { // console.error("Error sending email:", error); // } else { // console.log("Email sent successfully:", info.response); // } // }) } }