Lesson Description

The "Resend Setup" Lesson is part of the full, Build a Fullstack Next.js App, v4 course featured in this preview video. Here's what you'd learn in this lesson:

Brian introduces sending emails using Resend, highlighting how it simplifies creating email templates and handling SMTP servers. He walks through setting up a Resend account, generating an API key, and explains limitations, such as needing a custom domain to send emails beyond your own address.

Preview

Transcript from the "Resend Setup" Lesson

[00:00:00]
>> Brian Holt: Let's do email. Who's really excited about email? Who hurt you? At my first job, which was a PHP job forever ago in Salt Lake City, I had to do a lot of emails and like writing like the actual email templates, and if you've ever actually directly written email templates, it's a new world of pain. Like, CSS doesn't work. You have to like inline everything and like back then, back in my day, we didn't have like tools that did that stuff for you.

[00:00:31]
So you actually had to like directly write the emails, put all like the inline CSS. You can only use some CSS, you couldn't use others. It would look different in like Thunderbird versus like Outlook versus Gmail versus Hotmail. It was the worst. That was like actually the least fun code I think I've ever written. Is that fair? Yeah, I think so. It's between that and some of the Java services I wrote at LinkedIn, that's a whole another rant for another day.

[00:01:00]
Who wants Brian to teach Java? Nobody. Nobody wants Brian to teach Java. Anyway. All right. Email, somehow we've moved back around to look, let's do email. Email is, it was really painful to do, and now there's some services that have really like glossed over what makes them difficult, even like using SES, which is the AWS service, Amazon Simple Email Service, is quite nice to how it compared to how it used to be, like managing your own SMTP server and all those kinds of different things.

[00:01:32]
But what Resend does, which is a new startup, they have taken essentially I think it is actually even literally SES, they've wrapped it, they've made it very nice to work with, it's a very nice API. So, let's actually just open it. Let's go to resend.com. I'm already logged in here. You're going to log in, you should land on a page that looks like this. You can see here I've been sending test emails while I've been preparing this course.

[00:01:59]
I'm going to need you to come to API keys. There we go. I mean, that's fine, we'll do this. Is everyone getting to like this kind of page here? OK, cool. You're going to say create an API key, we're going to call this one FEM Wiki Masters, doesn't matter what, whatever you call it, just so you can refer to it. You can send it, either just sending access or full access. This is not a web security course, YOLO, let's just do full access.

[00:02:28]
The other thing, I'm going to give you a couple of caveats here. So first of all, let's just grab this first. And let's go put this in our .env file. .env we're going to come in here. This is going to be called, yeah, there we go. Resend API key like that. Something like that. You can surround it with quotes or not. In this case it's not necessary, but let's just do it. OK. So, we'll click done here.

[00:03:10]
So a couple of caveats about Resend. If you've ever worked with like giving away like free tier services or something like that, people love to abuse it, and the two things that people love to abuse are notification services like Resend or free compute, so that they can go mine Bitcoin. So in other words, there's a lot of guardrails around the free tier for this. So when you'll, if you pay them, they'll get there's less restrictions.

[00:03:35]
I don't think I've paid them, I think I still am on a free account here. But the other thing I'm going to say is, if you don't set up a custom domain, you can't receive the emails. What is it here? Resend will only let you send emails to yourself until you set up a custom domain. That's what it is. So you can't send an email to like a test account or anything like that. You have to only send it to yourself until you set up a custom domain.

[00:04:01]
You can see here on domains, I have gone and actually set up one for myself. I just set up, I have, you know, Holt.courses, because as you can see here, that's what these are on. It takes a second because it's all DNS, right? DNS takes forever to propagate. So, for the sake of this course, you can go set up a custom domain if you have one, great. Otherwise, just be aware that you're only going to be able to send an email to yourself, the one that you signed up with, right?

[00:04:31]
So I signed up with my Gmail account here, I'd only be able to send an email to my Gmail account. Likewise, you can only use their email domain to send from, right, which I think is like resend.dev or something like that, until you set up your own custom domain, I think that makes sense as well. Makes sense? So just be aware, your hands are tied with this API until you set up your own custom domain.

[00:04:58]
Yeah, and I think like here, like you just have to go set up a text thing, some MX things, and then like it's actually not very hard, it just takes like 10 minutes for it to propagate typically.

Learn Straight from the Experts Who Shape the Modern Web

  • 250+
    In-depth Courses
  • Industry Leading Experts
  • 24
    Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now