-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4fbe856
commit 46c6d46
Showing
7 changed files
with
8,109 additions
and
3,434 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import React from "react" | ||
import { | ||
Html, | ||
Body, | ||
Head, | ||
Heading, | ||
Hr, | ||
Container, | ||
Preview, | ||
Section, | ||
Text, | ||
} from "@react-email/components" | ||
import { Tailwind } from "@react-email/tailwind" | ||
|
||
export default function NewsletterEmail({ subscriberEmail }) { | ||
return ( | ||
<Html> | ||
<Head /> | ||
<Preview>New message</Preview> | ||
<Tailwind> | ||
<Body className="bg-gray-100 my-10 px-10 py-4 rounded-md text-black"> | ||
<Container> | ||
<Section> | ||
<Heading> | ||
Hello, I will gladly share my update with you. Keep in touch! | ||
</Heading> | ||
<Text>Some new subscriber</Text> | ||
<Hr /> | ||
<Text>Sender email {subscriberEmail}</Text> | ||
</Section> | ||
</Container> | ||
</Body> | ||
</Tailwind> | ||
</Html> | ||
) | ||
} |
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
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
"use server" | ||
// use resend to send email | ||
import { Resend } from "resend" | ||
import NewsLetterEmail from "@/app/email-template/newsletter" | ||
import React from "react" | ||
|
||
const resend = new Resend(process.env.RESEND_API_KEY) | ||
|
||
export async function newsLetterSignup(subscriberEmail) { | ||
try { | ||
const data = await resend.emails.send({ | ||
from: "MySite Notif <[email protected]>", // TODO: my own domain | ||
to: process.env.EMAIL_PERSONAL, // send to myself | ||
subject: `new subscriber ${subscriberEmail}`, | ||
reply_to: subscriberEmail, | ||
// text: "new subscriber alert", | ||
react: <NewsLetterEmail subscriberEmail={subscriberEmail} />, | ||
// react: React.createElement(NewsLetterEmail, { subscriberEmail }), | ||
}) | ||
return data | ||
} catch (error) { | ||
return { | ||
error: "something wrong with the email sending process", | ||
} | ||
} | ||
} |