> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mailofly.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Examples

> Starter kits, open-source repositories, and code examples for Mailofly.

# Examples

Explore ready-to-deploy examples, starter kits, and code recipes for integrating Mailofly into your applications.

***

## Starter Kits

<CardGroup cols={2}>
  <Card title="Next.js Transactional Starter" icon="react">
    A complete Next.js App Router starter demonstrating transactional emails, contact forms, and webhook handlers.
  </Card>

  <Card title="Supabase Auth + Mailofly" icon="database">
    Configure custom email templates for magic links, OTPs, and password reset flows with Supabase Auth.
  </Card>

  <Card title="Waitlist & Referral Engine" icon="user-plus">
    Collect signups, verify emails, send confirmation links, and track invite referrals.
  </Card>

  <Card title="E-commerce Order Receipt" icon="receipt">
    Generate dynamic HTML order receipts and invoices with embedded images and PDF attachments.
  </Card>
</CardGroup>

***

## Code Recipes by Use Case

### 1. Welcome Email on Signup

```typescript theme={null}
import { Mailofly } from 'mailofly';

const mailofly = new Mailofly(process.env.MAILOFLY_API_KEY);

export async function sendWelcomeEmail(user: { email: string; name: string }) {
  const { data, error } = await mailofly.emails.send({
    from: 'welcome@yourcompany.com',
    to: user.email,
    subject: `Welcome to our platform, ${user.name}!`,
    html: `<h1>Welcome aboard!</h1><p>We are thrilled to have you with us.</p>`,
  });

  if (error) {
    console.error('Failed to send welcome email:', error);
    throw error;
  }

  return data;
}
```

### 2. Magic Link Authentication

```typescript theme={null}
export async function sendMagicLink(email: string, token: string) {
  const loginUrl = `https://app.yourcompany.com/auth/verify?token=${token}`;

  await mailofly.emails.send({
    from: 'auth@yourcompany.com',
    to: email,
    subject: 'Sign in to your account',
    html: `
      <p>Click the link below to sign in:</p>
      <a href="${loginUrl}" style="display:inline-block;padding:12px 24px;background:#000;color:#fff;text-decoration:none;border-radius:6px;">
        Sign In
      </a>
      <p>This link expires in 15 minutes.</p>
    `,
  });
}
```

### 3. Batch Order Notifications

```typescript theme={null}
export async function sendBatchShippingUpdates(updates: Array<{ email: string; orderId: string }>) {
  const emails = updates.map((u) => ({
    from: 'orders@yourcompany.com',
    to: u.email,
    subject: `Order #${u.orderId} has shipped!`,
    html: `<p>Good news! Your order <strong>#${u.orderId}</strong> is on its way.</p>`,
  }));

  const { data } = await mailofly.batch.send(emails);
  return data;
}
```

***

## Multi-Language Quickstarts

Need language-specific sample repositories? Check our quickstarts:

* [Node.js / TypeScript Example](../getting-started/nodejs)
* [Python Quickstart](../getting-started/python)
* [Go Example](../getting-started/go)
* [PHP / Laravel Example](../getting-started/php)
* [Dart / Flutter Example](../getting-started/dart)
* [cURL / Raw HTTP Example](../getting-started/http)


## Related topics

- [Examples](/examples/index.md)
- [Introduction](/api/index.md)
- [Custom Headers](/sending/custom-headers.md)
- [Verify signatures](/webhooks/verify-signatures.md)
- [Send Test Emails](/sending/send-test-emails.md)
