From the course: Next.js Ecommerce: Build a Shopping Platform from Scratch

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Resend main function

Resend main function

So now we're going to create our email template for the purchase receipt. And the way that we send the email is with this resend package that we already installed. And we basically need to just create a new instance. And then we can call resend.emails.send, pass in the from, the to, subject. We can pass in text for the body, HTML, or we can pass in React, which would be a React component. And that's what we're going to do. And then the component, we're going to put that together using React email package that we installed. And that has a bunch of predefined components that we can use to create the template. So let's go into the root of our project and create an email folder. And then from there, we're going to have an index.tsx. That's where we're going to initialize that resend object and send the email. And then we'll have another file that will be the component. And we'll call that Purchase-Receipt.TSX. And we're going to go into the index first. And from there, we want to import…

Contents