Real-time Notification Emails

Keep users informed with instant notification emails. Activity alerts, status updates, and important announcements delivered reliably.

  • Instant delivery for time-sensitive alerts
  • Customizable notification types
  • Action buttons for quick response
  • Unsubscribe link management
  • Notification preference support

Code Example

Send notification emails with the TigerMail API.

type NotificationType = "comment" | "mention" | "update" | "alert";

interface Notification {
  type: NotificationType;
  userEmail: string;
  userName: string;
  title: string;
  message: string;
  actionUrl?: string;
  actionLabel?: string;
}

async function sendNotificationEmail(notification: Notification) {
  const actionHtml = notification.actionUrl
    ? `<p><a href="${notification.actionUrl}" style="
        background: #f97316;
        color: white;
        padding: 10px 20px;
        text-decoration: none;
        border-radius: 4px;
      ">${notification.actionLabel || "View"}</a></p>`
    : "";

  const response = await fetch("https://tigermail.io/api/v1/send", {
    method: "POST",
    headers: {
      "Authorization": `Bearer ${process.env.TIGERMAIL_API_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      to: [notification.userEmail],
      from: "notifications@yourapp.com",
      subject: notification.title,
      html: `
        <p>Hi ${notification.userName},</p>
        <p>${notification.message}</p>
        ${actionHtml}
        <hr>
        <p style="font-size: 12px; color: #666;">
          <a href="https://yourapp.com/settings/notifications">
            Manage notification preferences
          </a>
        </p>
      `,
    }),
  });

  return response.json();
}

// Usage examples:
await sendNotificationEmail({
  type: "comment",
  userEmail: "user@example.com",
  userName: "John",
  title: "New comment on your post",
  message: "Sarah commented: 'Great work on this!'",
  actionUrl: "https://yourapp.com/posts/123",
  actionLabel: "View Comment",
});

Best Practices

Follow these guidelines for effective notification emails.

Keep subject lines clear and actionable
Include context about the notification
Add clear call-to-action when needed
Respect user notification preferences
Include unsubscribe option for non-critical notifications
Use appropriate urgency indicators

Skip the Boilerplate with AI

Don't want to write this code yourself? Use our AI-native integration. Copy instructions into Claude Code or Cursor, and let AI generatenotification emails code tailored to your project.

Start sending notification emails

Get 1,000 free emails per month. Set up in under 5 minutes.