fix: migrate registro email from Resend to Nodemailer+Gmail
Deploy / deploy (push) Successful in 3m6s
Deploy / deploy (push) Successful in 3m6s
This commit is contained in:
@@ -1,8 +1,16 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
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) {
|
||||
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 },
|
||||
});
|
||||
|
||||
await resend.emails.send({
|
||||
from: "Taller <onboarding@resend.dev>",
|
||||
to: "jpbeldomenico@gmail.com",
|
||||
await transporter.sendMail({
|
||||
from: `"Taller" <${process.env.GMAIL_USER}>`,
|
||||
to: email,
|
||||
subject: "¡Bienvenido al taller!",
|
||||
html: `
|
||||
<h2>¡Hola ${nombre}!</h2>
|
||||
|
||||
Reference in New Issue
Block a user