Skip to content

Commit

Permalink
WIP email should be sending but getting a console message
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanKha committed Oct 22, 2024
1 parent 0813643 commit 4876ba2
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,36 @@
import { render } from "@react-email/components";
import nodemailer from "nodemailer";

import WelcomeEmail from "@/components/emails/WelcomeEmail";

const transporter = nodemailer.createTransport({
host: "smtp.forwardemail.net",
port: 465,
secure: true,
auth: {
user: process.env.SCF_GMAIL,
pass: process.env.SCF_GMAIL_APP_PASSWORD,
},
});

async function sendEmail() {
const emailHtml = await render(
<WelcomeEmail firstName="Alan" programName="Test" />,
);

const options = {
from: process.env.SCF_GMAIL,
to: "khalilialan@gmail.com", // Replace with your email
subject: "hello world",
html: emailHtml,
};

await transporter.sendMail(options);
console.log("Email sent");
}

sendEmail();

export default function Home() {
return <p>Home page</p>;
}

0 comments on commit 4876ba2

Please sign in to comment.