To use SendGrid with SuperStarter

1

Create a SendGrid account

Create a SendGrid account and grab your API key.

2

Add environment variables

Add the SENDGIRD_TOKEN environment variables to your .env.local file and your deployment environment:

Then, make sure to activate SendGrid:

/packages/email/index.ts
export * from './providers/sendgrid';
3

Sending Emails

apps/web/app/contact/actions/contact.tsx
import { sendgridClient } from '@repo/email';
import { ContactTemplate } from '@repo/email/emails/contact';
import { render } from "@react-email/components";

const emailHtml = await render(<ContactTemplate name={name} email={email} message={message} />);

await sendgridClient.send({
    from: 'sender@acme.com',
    to: 'recipient@acme.com',
    subject: 'The email subject',
    react: emailHtml,
});