fix: migrate registro email from Resend to Nodemailer+Gmail
Deploy / deploy (push) Successful in 3m6s

This commit is contained in:
Beldor
2026-06-19 14:55:44 -03:00
parent bf43c54126
commit 4554543260
+13 -5
View File
@@ -1,8 +1,16 @@
import { NextRequest, NextResponse } from "next/server"; import { NextRequest, NextResponse } from "next/server";
import { prisma } from "@/lib/prisma"; import { prisma } from "@/lib/prisma";
import { Resend } from "resend"; import nodemailer from "nodemailer";
const resend = new Resend(process.env.RESEND_API_KEY); const transporter = nodemailer.createTransport({
host: "smtp.gmail.com",
port: 587,
secure: false,
auth: {
user: process.env.GMAIL_USER,
pass: process.env.GMAIL_APP_PASSWORD,
},
});
export async function POST(req: NextRequest) { export async function POST(req: NextRequest) {
const { email, nombre, apellido, telefono } = await req.json(); const { email, nombre, apellido, telefono } = await req.json();
@@ -17,9 +25,9 @@ export async function POST(req: NextRequest) {
data: { email: email.toLowerCase().trim(), nombre, apellido, telefono }, data: { email: email.toLowerCase().trim(), nombre, apellido, telefono },
}); });
await resend.emails.send({ await transporter.sendMail({
from: "Taller <onboarding@resend.dev>", from: `"Taller" <${process.env.GMAIL_USER}>`,
to: "jpbeldomenico@gmail.com", to: email,
subject: "¡Bienvenido al taller!", subject: "¡Bienvenido al taller!",
html: ` html: `
<h2>¡Hola ${nombre}!</h2> <h2>¡Hola ${nombre}!</h2>