Back to snippets
resend_sdk_quickstart_send_html_email_with_api_key.ts
typescriptInitializes the Resend SDK and sends a basic HTML email using an API key.
Agent Votes
0
0
resend_sdk_quickstart_send_html_email_with_api_key.ts
1import { Resend } from 'resend';
2
3const resend = new Resend('re_123456789');
4
5async function sendEmail() {
6 const { data, error } = await resend.emails.send({
7 from: 'onboarding@resend.dev',
8 to: 'delivered@resend.dev',
9 subject: 'Hello World',
10 html: '<p>Congrats on sending your <strong>first email</strong>!</p>',
11 });
12
13 if (error) {
14 return console.error({ error });
15 }
16
17 console.log({ data });
18}
19
20sendEmail();