Skip to content

Join the Seedly owners community →

Email

Resend Basics

Why sending email is hard and how to send your first email with Resend

Written by 3 min read1 activity
Pixl, your presenter

Pixl presents

Spam filters hate your brand new server. Resend gets your first email delivered without you begging Gmail for mercy.Spam filters hate your brand new server. Resend gets your first email delivered without you begging Gmail for mercy.

Pixl smirks by a hedge maze as an envelope rides a brass zip line over it to a mailbox
Resend carries your email past the tricky spam filter maze

Your app is gonna need to send emails. Welcome messages when someone signs up, password reset links, order confirmations, notifications... email is still the main way apps talk to their users.

Sending email turns out to be weirdly tricky though. That's where Resend comes in.

Why Sending Email Is Hard#

You might be thinking "email is ancient technology, how hard can it be?" Pretty hard, it turns out.

Step 1. Spam Filters#

Email providers like Gmail are aggressive about blocking spam. Send emails the wrong way and they land straight in the spam folder, or get blocked completely.

Step 2. Authentication#

Modern email needs SPF, DKIM and DMARC records. These prove your emails are legit. Getting them set up right is confusing.

Step 3. Deliverability#

Even with everything set up properly, you still have to build a "sender reputation." New senders get treated with suspicion.

Step 4. Bounces and Complaints#

When emails fail to deliver or people mark you as spam, you have to handle those signals the right way. Ignore them and your reputation TANKS.

Enter Resend#

Pixl fixes a blank brass nameplate onto his own wooden mailbox while holding its key
To send email you need a domain of your own

Resend is an email service built for developers. You skip fighting with email servers yourself and just use their API to send emails. They handle all the tricky parts.

Here's why developers love it.

  • Simple API. Send an email in a few lines of code
  • Great deliverability. They maintain the sender reputation for you
  • Beautiful emails. Built-in support for modern email design
  • Dashboard. See which emails were sent and delivered (plus opens and clicks once you switch tracking on)
  • Fast. Emails go out in milliseconds

Sending Your First Email#

Here's how simple sending an email with Resend really is. Install the package first, then put your API key in .env as RESEND_API_KEY.

npm install resend
import { Resend } from 'resend'
 
// Your key lives in .env, never pasted straight into your code
const resend = new Resend(process.env.RESEND_API_KEY)
 
const { data, error } = await resend.emails.send({
  from: 'YourApp <[email protected]>',
  to: '[email protected]',
  subject: 'Welcome to Our App!',
  html: '<p>Thanks for signing up!</p>'
})
 
if (error) {
  console.error(error)
}

That's it. A handful of lines and your email is out the door. Resend doesn't throw when a send fails, it hands you back an error instead, so check it (otherwise failures just vanish quietly).

Quick word on that API key though. Treat it like a credit card. I've posted before about a guy who got billed thousands through Resend because nothing was capping his spend. Keep the key secret and keep an eye on your usage (future you will thank you).

This lesson ends with a short activity.