简体中文
了解如何使用SendGrid发送邮件。
创建SendGrid账户
添加环境变量
SENDGIRD_TOKEN
export * from './providers/sendgrid';
发送邮件
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: '邮件主题', react: emailHtml, });