-
-
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
dfd3bf0
commit b76eb67
Showing
7 changed files
with
55 additions
and
64 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 |
---|---|---|
|
@@ -4,7 +4,7 @@ import { | |
Handler, | ||
} from "aws-lambda"; | ||
import fetch from "node-fetch"; | ||
import { EmailTemplate } from "./src/emails/test"; | ||
import { renderEmail } from "renderEmail"; // Import the function from the .tsx file | ||
|
||
const RESEND_API_KEY = process.env["RESEND_API_KEY"]; | ||
|
||
|
@@ -13,6 +13,11 @@ interface ResendResponse { | |
message?: string; | ||
} | ||
|
||
const html = renderEmail( | ||
"Kaarthik", // Provide title as a string | ||
"/" // Provide link as a string | ||
); | ||
|
||
export const handler: Handler = async ( | ||
event: APIGatewayProxyEvent | ||
): Promise<APIGatewayProxyResultV2> => { | ||
|
@@ -53,8 +58,7 @@ export const handler: Handler = async ( | |
from: "[email protected]", | ||
to: ["[email protected]"], | ||
subject: "hello world", | ||
react: EmailTemplate({ firstName: "John" }), | ||
html: "<h1>Hello world</h1>", | ||
html: html, | ||
text: "Hello world", | ||
}), | ||
}); | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { render } from "@react-email/render"; | ||
import React from "react"; | ||
import TestTemplate from "./src/emails/TestTemplate"; | ||
|
||
export function renderEmail(title: string, link: string) { | ||
return render(<TestTemplate title={title} link={link} />); | ||
} |
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,22 @@ | ||
// src/emails/testTemplate.tsx | ||
import { Button } from '@react-email/button'; | ||
import { Hr } from '@react-email/hr'; | ||
import { Html } from '@react-email/html'; | ||
import { Text } from '@react-email/text'; | ||
import * as React from 'react'; | ||
|
||
type TestTemplateProps = { | ||
/* Define the shape of the props here. For example: */ | ||
title: string; | ||
link: string; | ||
}; | ||
|
||
export default function TestTemplate({ title, link }: TestTemplateProps) { | ||
return ( | ||
<Html lang="en"> | ||
<Text>{title}</Text> | ||
<Hr /> | ||
<Button href={link}>Click me</Button> | ||
</Html> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.