Open Source

Email & OTP
for modern apps

Send emails through Gmail with zero configuration. Drop in beautiful OTP inputs that just work.

$npm install irismail
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,
  },
});

await mail.sendMail({
  to: 'user@example.com',
  subject: 'Welcome!',
  html: '<h1>Hello</h1>',
});
Email sent

Two tools, one package

Everything you need to handle emails and verification flows.

Email Service

Send transactional emails through Gmail. No SMTP headaches, no complex configuration.

const result = await mail.sendMail({
  to: 'user@example.com',
  subject: 'Reset your password',
  html: emailTemplate,
});

OTP Input

Beautiful OTP inputs with copy-paste, keyboard nav, and all accessibility built in.

< 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!