-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP email should be sending but getting a console message
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>; | ||
} |