2.2.0 • Published 6 months ago
@gns-org/email-templates v2.2.0
GNS - Email Templates
A collection of ready-to-use email templates for your applications, built with React Email.
Installation
npm install @gns-org/email
# or
yarn add @gns-org/email
# or
pnpm add @gns-org/email
Usage
Using React Components with Resend API
import { Resend } from 'resend';
import { Login } from '@gns-org/email';
const resend = new Resend(process.env.RESEND_API_KEY); // Replace with your API key
// Send email using Resend
async function sendLoginEmail(email, loginUrl) {
const { data, error } = await resend.emails.send({
from: 'Your App <onboarding@yourdomain.com>',
to: [email],
subject: 'Sign in to your account',
react: <Login
heroImage="https://placehold.co/400x200"
heading="Sign in to your account"
subheading="Click the button below to securely sign in to your account."
buttonLabel="Sign in securely"
buttonLink={loginUrl}
/>,
});
if (error) {
return { success: false, error };
}
return { success: true, data };
}
Available Templates
- Login: Email template for login links/magic links
Thanks/Inspo
Versioning
This project uses Epoch semantic versioning so expect many major breaking changes while it's in the 0'th epoch