InkFlip Docs

Email System

Transactional emails via Resend.

Overview

InkFlip uses Resend for transactional emails. All email logic is in lib/email.ts.

Email Types

EmailTriggerTemplate
VerificationUser registrationemails/verification-email.tsx
Password ResetForgot password requestemails/reset-password-email.tsx
WelcomeAfter email verificationInline
Purchase ConfirmationPayment webhookInline
Subscription ExpiryDays before expiryInline
Low Credits AlertBalance below thresholdInline
Newsletter confirmationNewsletter subscribe/resubscribeInline

Configuration

RESEND_API_KEY="re_your_api_key"
RESEND_FROM_EMAIL="InkFlip <noreply@inkflip.ink>"

RESEND_FROM_EMAIL should use an address from a verified Resend domain. If it is not set, production can fall back to:

RESEND_VERIFIED_DOMAIN="inkflip.ink"
RESEND_FROM_NAME="InkFlip"

For newsletter audience sync, configure:

RESEND_AUDIENCE_ID="your-resend-audience-id"

Development Mode

In development without a verified domain, the app uses InkFlip <onboarding@resend.dev> as the sender fallback.

Production

For production, verify your sending domain in the Resend dashboard and set RESEND_FROM_EMAIL in Vercel. Also confirm NEXT_PUBLIC_APP_URL points to the production domain, because verification and password-reset links are built from it.

Namecheap DNS setup

  1. In Resend, open Domains, add inkflip.ink, and copy the DNS records Resend shows for that domain.
  2. In Namecheap, open Domain Listinkflip.inkAdvanced DNS.
  3. Add each Resend record exactly as shown. Use the record type Resend provides, usually TXT and CNAME. For Namecheap's Host field, enter only the host prefix, not the full domain suffix. For example, use _dmarc instead of _dmarc.inkflip.ink.
  4. Save the records and wait for DNS propagation. Then return to Resend and click Verify DNS Records.
  5. After Resend marks the domain verified, deploy with:
RESEND_FROM_EMAIL="InkFlip <noreply@inkflip.ink>"
NEXT_PUBLIC_APP_URL="https://inkflip.ink"
BETTER_AUTH_URL="https://inkflip.ink"

The local .env.local can keep NEXT_PUBLIC_APP_URL="http://localhost:3000" for development. Production values should be set in the hosting provider environment.

Email Templates

Templates use React Email components in the emails/ directory:

// emails/verification-email.tsx
import { Html, Body, Text, Link } from '@react-email/components';

export default function VerificationEmail({ verificationUrl }: { verificationUrl: string }) {
  return (
    <Html>
      <Body>
        <Text>Click below to verify your email:</Text>
        <Link href={verificationUrl}>Verify Email</Link>
      </Body>
    </Html>
  );
}

Error Handling

All email sends are wrapped in try-catch. Failed sends are logged and return a controlled result instead of throwing:

const result = await sendVerificationEmail(email, token);

if (!result.success) {
  // handle email delivery failure
}

On this page