AI Folks
  • Courses
  • Web Of AI
  • Pricing
  • Enterprise
Log in
PreviousChecking RAG answersNextTaking payments with Stripe

Vibe Coder · Unit 18: Email, Payments and Commerce · Lesson 1 of 5

Transactional email with Resend

Your product has to send email: receipts, sign-in links, reminders. Send it through an email API, from your own verified domain, and know when it bounces.

Read the short notes and pictures.Do everything inside a blue frame.

Email is part of the product

Sign-up confirmations, receipts, reminders, "your export is ready": a working product sends email constantly. Supabase sends the sign-in emails for you, with limits. Everything else is yours to send, and it should come from your own domain so that people trust it and inboxes accept it.

Two kinds

Pale dots, hand-drawn. Two cards: transactional email, such as a receipt or sign-in link, and marketing email, such as a newsletter to a list.
Transactional mail answers an action. Marketing mail goes to a list.

Resend handles both: transactional emails, and what it calls Broadcasts, bulk messages to a contact list. Keep them separate in your head, because the rules differ. Nobody needs to opt in to receive their own receipt. Marketing email needs consent and an unsubscribe link.

Set it up

  1. 1

    Create a Resend account and an API key

    Store the key as a secret in your app or as a credential in n8n.

  2. 2

    Add your domain

    Resend shows you DNS records to add where your domain is managed.

  3. 3

    Wait for verification

    Until the domain is verified, send only test emails.

  4. 4

    Send one to yourself

    From an address at your domain.

Pale dots, hand-drawn. Three boxes: add DNS records, Resend checks them, verified.
Verifying your domain is what keeps mail out of spam.

Testing before your domain is ready

Resend’s quickstart sends from onboarding@resend.dev. That address is for testing only. Production mail must come from your own verified domain.

Sending

From code

import { Resend } from 'resend';

const resend = new Resend(process.env.RESEND_API_KEY);

const { data, error } = await resend.emails.send({
  from: 'Tally <hello@yourdomain.com>',
  to: ['asha@example.com'],
  subject: 'Your receipt',
  html: '<p>Thanks for your payment.</p>',
});

From n8n

HTTP Request node
Method: POST
URL: the Resend emails endpoint
Auth: a saved credential
Body: from, to, subject, html
      (filled with expressions)
The code follows Resend’s Node.js quickstart. In n8n, use the HTTP Request node from the last unit, with the key in a credential.

Writing email people read

Subject

Say what it is: "Your receipt from Tally", not "Important update".

One purpose

A receipt is a receipt. Do not add a sales pitch.

Plain and short

It should read well with images turned off.

A real reply address

People answer emails. Let them.

Knowing what happened

Sending is not the same as arriving. Resend can call a webhook when an email is delivered, bounces or is marked as spam. Point that webhook at an n8n workflow and record the result against the user.

Stop when asked

If an address bounces, stop sending to it. If someone marks your mail as spam, stop emailing them. Continuing to send damages your domain’s reputation, and then nobody gets your receipts.

ActivityYour turnWrite it yourself first, then compare.

List every email your product sends, and mark each as transactional or marketing.

ActivityBuild stepA product that can charge

Send your product’s first real email

Set up Resend with your own domain. Send one transactional email from your product, triggered by a real action, such as a welcome on sign-up. Add a webhook workflow that records bounces.

Done when

Put the email templates in your repository as files, so that changes to wording are tracked.

Keep these

  • Send through an email API from your own verified domain.
  • Transactional and marketing mail follow different rules.
  • Listen for bounces and complaints, and stop when asked.
Back toVibe CoderNext lessonTaking payments with Stripe