< 5kb
Bundle Size
gzipped
2
Dependencies
minimal
100%
TypeScript
typed
ISC
License
open source
Quick Start
Get running in under a minute.
1Server — Send emails
app/api/send/route.tsts
import { IrisMail } from 'irismail/server';
const mail = new IrisMail({
auth: {
user: process.env.GMAIL_USER!,
pass: process.env.GMAIL_APP_PASSWORD!,
},
});
export async function POST(req: Request) {
const { to, subject, html } = await req.json();
const result = await mail.sendMail({
from: process.env.GMAIL_USER!,
to, subject, html,
});
return Response.json(result);
}2Client — OTP verification
components/verify.tsxtsx
'use client';
import { useState } from 'react';
import { OTP } from 'irismail/react';
export function VerifyForm() {
const [code, setCode] = useState('');
const handleComplete = async (value: string) => {
const res = await fetch('/api/verify', {
method: 'POST',
body: JSON.stringify({ code: value }),
});
// Handle response...
};
return <OTP value={code} onChange={setCode} onComplete={handleComplete} />;
}Ready to get started?
Install the package and check out the docs. If you find it useful, star us on GitHub!