Тёмный

Create & Send Custom Emails with React Email & Resend 

Colby Fayock
Подписаться 27 тыс.
Просмотров 58 тыс.
50% 1

Build custom email templates using React and Typescript and send them using Resend.
We'll walk through setting up React Email in a Next.js project, creating a new React email template, setting up an API route, and using Resend to send the emails.
🧰 Resources
Code: github.com/colbyfayock/my-rea...
Starter: github.com/colbyfayock/demo-e...
Tutorial: spacejelly.dev/posts/how-to-s...
📺 RU-vid: ru-vid.com?sub_c...
🐦 Twitter: / colbyfayock
📹 Twitch: / colbyfayock
✉️ Newsletter: www.colbyfayock.com/newsletter/
🎥 What I Use: www.colbyfayock.com/uses
#colbyfayock #reactjs #email #nextjs #resend #webdevelopment

Наука

Опубликовано:

 

13 июн 2023

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 119   
@colbyfayock
@colbyfayock Год назад
Get fresh tutorials and other free content straight to your inbox! colbyfayock.com/news
@mylooooooooooo
@mylooooooooooo Год назад
Colby, you might not believe it, but I gotta say, out of all the RU-vidrs teaching React, you're hands down the clearest and most concise! Keep doing your thing-I can definitely see you going far!
@colbyfayock
@colbyfayock Год назад
really appreciate that 🙏
@xgtwb6473
@xgtwb6473 Год назад
Reminds me of fireship but better
@colbyfayock
@colbyfayock Год назад
@@xgtwb6473 huge compliment, thank you 🙏
@Cammmm92837
@Cammmm92837 Год назад
Just found your channel the other day. Your videos rock! Super helpful. Keep it up! 😄
@colbyfayock
@colbyfayock Год назад
thanks Cam! 🙌
@xgtwb6473
@xgtwb6473 Год назад
Love the fast pace. Thank you sir! 🎉
@colbyfayock
@colbyfayock Год назад
no problem!
@Michael-Martell
@Michael-Martell 8 месяцев назад
I’ve been fighting to pass data into it all day. Thanks so much I’d hug you in real life!
@colbyfayock
@colbyfayock 8 месяцев назад
glad ot hear it helped!
@zeno_rocha
@zeno_rocha Год назад
Hey everyone, Resend founder here. It was really nice to watch this video - you crushed it Colby! Let me know if any of you have questions about Resend or React Email. Happy to answer them here :)
@colbyfayock
@colbyfayock Год назад
thanks Zeno!! 🙌
@ZeroTorySeats
@ZeroTorySeats Год назад
When is it likely to receive a stable release?
@carracingsongs
@carracingsongs 8 месяцев назад
@zeno_rocha thanks for creating an amazing product. Resend is great! Muita força e sucesso!
@appstuff6565
@appstuff6565 8 месяцев назад
hi zeno, just wanted to ask why would anyone choose resend over amazon ses? Genuinely asking. thanks!
@user-vy8tp8ol3m
@user-vy8tp8ol3m Год назад
Love seeing you use typescript!
@colbyfayock
@colbyfayock Год назад
im trying! :D
@username-t1x
@username-t1x 2 месяца назад
Great tutorial, really appreciate it Colby!
@colbyfayock
@colbyfayock 2 месяца назад
no problem!
@CRTechInformatica
@CRTechInformatica 8 месяцев назад
Button and Link not found in production, only dev get the click, cursor pointer
@jampy42
@jampy42 Год назад
Hey Colby, nice video, I've been trying react email and it's awesome, but for some reason I don't have autocomplete in the components props, do you have this issue too?
@colbyfayock
@colbyfayock Год назад
yeah im actually not seeing it either 🤔 might be worth an issue on their GitHub
@kevinnorton3972
@kevinnorton3972 11 месяцев назад
Has anyone implemented ReCaptcha with sending emails in NextJs 13
@heyitsjoshd
@heyitsjoshd 8 месяцев назад
I made an awesome email thanks to you!
@colbyfayock
@colbyfayock 8 месяцев назад
wonderful! glad to hear this helped :D
@jacquelynecarmen
@jacquelynecarmen 3 месяца назад
In this video you just create api endpoint in nextJS, but little bit confused my app totally front-end based no any backend for now i use emailJs to send emails can we used resend on client side without creating api endpoint just create function on clients and called that function on submit it will be worked?
@colbyfayock
@colbyfayock 3 месяца назад
i dont think you can do that with Resend, reason being, you would want some kind of security measure around calling that endpoint in order to make sure someone isn't abusing it if you're submitting a form clientside directly to the API, someone can see that API request in the network logs along with the API key that you're sending and spam it while creating an endpoint that wraps the Resend request doesnt outright prevent that if you're submitting it clientside, you're at least not sharing the keys alongside of it, and in Next.js, you're also avoiding cross origin requests, thoguh you'd still likely want more security and spam prevent measures around that experience
@christiangonzalez7583
@christiangonzalez7583 2 месяца назад
Hi, great video, but one question. I'm trying to send emails to different email accounts, but it only allows me to send emails to the account I signed up with for Resend. Is a change required to send emails from production to any email account?
@colbyfayock
@colbyfayock 2 месяца назад
you need to use your own verified domain, not the @resend address, which is only for testing
@harshitvishwakarma4910
@harshitvishwakarma4910 3 месяца назад
I am trying to send email using resend in node js, but getting unable to verify leaf signature error even though I configured ssl certificates using openssl and also tried switching to https but not getting any changes. Please help 😢
@colbyfayock
@colbyfayock 3 месяца назад
not sure about that one :( id try reaching out to their support
@MrManik1111
@MrManik1111 2 месяца назад
Thanks for another great tutorial. How can I check anybody's reply of react email? as I don't have mail box.
@colbyfayock
@colbyfayock 2 месяца назад
You can use the reply to field to set an email address that the email provider would open when clicking reply
@moussaabmoulim5821
@moussaabmoulim5821 11 месяцев назад
thanks for the video exactly what i needed but how can you access env variables inside reactnail components
@colbyfayock
@colbyfayock 11 месяцев назад
hey glad to hear it helped! you may need to use dotenv when using it locally, i haven't tested this yet, but thats a common solution
@kakun7238
@kakun7238 11 месяцев назад
ok but how do i deploy it do i send the node_modules in the react-email-starter im stuck
@colbyfayock
@colbyfayock 11 месяцев назад
my understanding is it would work like any other deployed dependency from within the serverless function - the build and deploy step is managed by the provider, say for instance you're deploying on vercel, as long as the react-email dependency is pulled in along with Resend, it would bundle that up and handle the processing of the email are you experiencing something different?
@jenks2897
@jenks2897 Год назад
Question why are the changes not reflecting in the UI after updating the code ?
@colbyfayock
@colbyfayock Год назад
hey what timestamp are you referring to? im not quite sure what you mean
@damianalcalaylopez7229
@damianalcalaylopez7229 9 месяцев назад
Hey Colby, thanks for the vid man! Do you know how to attach a pdf or image file to the email?
@colbyfayock
@colbyfayock 9 месяцев назад
looks like the `attachments` key when sending the email through Resend: resend.com/docs/api-reference/emails/send-email
@k303k
@k303k 7 месяцев назад
Hi sir How to fix the issue curtently i am using next13.4 and i have installed the dependencies but when i run yarn dev for email dev script it only create .react-email-tempo folder and it gives me error . how to fix it sir?
@colbyfayock
@colbyfayock 7 месяцев назад
hey not sure about that, i would recommend seeing if there's an existing issue on the React Email repository and if not ,creating one github.com/resendlabs/react-email
@nazinhalira
@nazinhalira 11 месяцев назад
it was a perfect tutorial! I'm having problems to config resend, i was trying to learn but if i'm right, i only can send a e-mail if I config the domain and the DNS, so i cant practice without paying for a domain. But your tutorial is excelent!
@nazinhalira
@nazinhalira 11 месяцев назад
i was trying with a free domain (like vercel)
@colbyfayock
@colbyfayock 11 месяцев назад
@@nazinhalira thanks! yeah i wouldnt expect you to be able to configure DNS for vercel subdomains unfortunately. you could probably find really cheap domains for 1 year and cancel before, but that would still require a payment
@appstuff6565
@appstuff6565 8 месяцев назад
Hi there Colby, I wanted to ask if you would recommend Amazon Ses vs Resend. What do you recommend? Also, i need to implement a forgot password / recover password page where i take in the user email and send a "reset password" email to that email, if it exists. I wanted to ask how would you go about implementing it? Im using nextjs 13 (app router) with Supabase. Currently using supabase smtp but going to go custom since supabase smtp is not production ready. Thanks for your time and clearing my doubts in advance! :D
@colbyfayock
@colbyfayock 8 месяцев назад
Hey, Amazon SES vs Resend is really a matter of paying for the wrapper that Resend adds to what I believe is SES that they use themselves. from past experience SES is a pain where Resend is really easy to use. if your budget supports it, it definitely would make your developer experience better. have to consider the tradeoffs between the work of building an SES solution and all the thigns that go along with it manually as far as a forgot/recover password page, i'm not familiar with how supabase works, but typically you would build a page in your app where when submitting their email address, you use an API to trigger the password recovery process not straightforward answers but hope it helps
@appstuff6565
@appstuff6565 8 месяцев назад
yes thanks!@@colbyfayock
@rbpolim
@rbpolim Год назад
Thanks for this Colby. What is the name of your theme?
@colbyfayock
@colbyfayock Год назад
No problem! Night Owl marketplace.visualstudio.com/items?itemName=sdras.night-owl
@raphauy
@raphauy Год назад
Thank you very much!!!
@colbyfayock
@colbyfayock Год назад
you're welcome!
@pjborowiecki2577
@pjborowiecki2577 Год назад
@colbyfayock Great video! Out of curiosity - if Resend is a paid service after a certain threshold, how would you protect yourself from malicious attempts of ramping up your bills by bots or someone inputing random emails in the form? How difficult would it be to build your own, free alternative to Resend? A tutorial on this would be SUPER COOL
@colbyfayock
@colbyfayock Год назад
thanks :) starting off with building your own, i believe Resend uses AWS SES under the hood: aws.amazon.com/ses/ - it's certainly within reason to be able to do that, ive worked at companies that have used SES for transactional emails, but it can be a pain. im sure you could even export rendered React Email templates and ship with that if you want. if you're comfortable in AWS environments definitely doable!! i would imagine there are videos out there, but honestly i can't see myself making a tutorial on that at the moment (i still have AWS PTSD, i'm enjoy the front end, but used to get pulled into AWS a lot haha) as far as ramping up bills, i think that's a separate challenge and one you'd face with any solution. its a tough one, there are a bunch of solutions including Google's ReCAPTCHA www.google.com/recaptcha/about/ - only some people dont like using Google, but there's a lot of other alternatives these days you can google around for
@NanaOkae
@NanaOkae 3 месяца назад
how long does it take for a domain to be verified ?
@colbyfayock
@colbyfayock 3 месяца назад
it usually happens very quickly, but that depends on your domain provider. Resend will be able to read your domain's DNS entries basically right away, but your provider needs to propagate them which i believe could take up to 48 hrs iirc. Mine just took a few moments
@vamsikrishna-yl7ol
@vamsikrishna-yl7ol 7 месяцев назад
How can i use it with react-remix app?
@colbyfayock
@colbyfayock 7 месяцев назад
never used remix, but here are two resources you can check out: resend.com/docs/send-with-remix github.com/resend/resend-remix-example
@wellbell23
@wellbell23 3 месяца назад
I made a project including resend and react email and I can send only email to myself?so is this error or their policy?
@colbyfayock
@colbyfayock 3 месяца назад
hey that sounds like you might be trying to use the Resend email for the `from` address, which you're not able to use. thats simply for testing purposes. you need to configure your own domain to send emails to other people resend.com/docs/dashboard/domains/introduction
@wellbell23
@wellbell23 3 месяца назад
@@colbyfayock so can I submit it as a project if I don't have any domain?
@wellbell23
@wellbell23 3 месяца назад
@@colbyfayock please reply
@colbyfayock
@colbyfayock 3 месяца назад
​@@wellbell23 can you elaborate about what you mean about submitting as a project? i dont believe Resend provides free domains in any way, so typically you'll need a real domain to set this up. a good place to get domains is Porkbun where you can find some inexpensive options: porkbun.com/
@eb9623
@eb9623 5 месяцев назад
Hi, i get the "404 This page could not be found." error, when i try to call it from browser with GET method. I do the same things like you. I can see the template but cannot overcome this error. Any idea?
@colbyfayock
@colbyfayock 5 месяцев назад
hey have you checked out my code? github.com/colbyfayock/my-react-email its also worth noting i believe they launched a big update, its quite possible something changed as i havent updated to that yet
@eb9623
@eb9623 5 месяцев назад
@@colbyfayock Yes i checked. The versions are higher now and i think structure was also changed. I am searching for solutions.
@mateusloubach
@mateusloubach 3 месяца назад
1st thing you need to check is if you're running both your dev and email via the npm run on terminal. - after opening your project, manually enter the "/api/email" (or the place where you set your route) to run the GET method to get result. IF you're not getting the email, even though you're getting the correct status msg, make sure you're inserting the email you're using via the resend website where you got your API from.
@OnlyJavascript
@OnlyJavascript Год назад
I couldn't change the from and to address. It's not working when I change them.
@colbyfayock
@colbyfayock Год назад
can you share the code? here's what mine looked like: github.com/colbyfayock/my-react-email/blob/main/src/app/api/email/route.ts#L13
@OnlyJavascript
@OnlyJavascript Год назад
@@colbyfayock ah..i just cloned ur code and added my api key. it failed.
@OnlyJavascript
@OnlyJavascript Год назад
{ "statusCode": 422, "name": "missing_required_field", "message": "Missing `from` field" }
@davidbodunrin87
@davidbodunrin87 11 месяцев назад
thank you !
@colbyfayock
@colbyfayock 11 месяцев назад
you're welcome!
@guillermo.avalos
@guillermo.avalos Год назад
You don't really have to install the entire react-email app on every project. What I did was simply create a standalone implementation that I could use to understand how to design the templates, and later in my actual project I just install all the dependencies for the templates (Section, Text, and so on) along with resend (or the render function, if I needed a different email provider).
@colbyfayock
@colbyfayock Год назад
oh nice good to know. from what i can tell the react-email package though provides the dev mode, so i guess does that mean you're not using their built in previewer? might be a naive concern, but i would expect there's more to that preview page than just a simple dump of components, since email html/css is more strict. unsure though
@delfinamolter1514
@delfinamolter1514 6 месяцев назад
Hi, nice tutoril! thanks! I made a form that need to send a fild and i don´t know how to do it. Can you share same info to do that :)
@colbyfayock
@colbyfayock 6 месяцев назад
this tutorial might help: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-8uChP5ivQ1Q.html doesn't cover it exactly, but through the process of adding / selecting a file, you would want to upload it somewhere instead of on submit, so then once the file is submitted, you can send the URL
@ArysOakheart-qz2wb
@ArysOakheart-qz2wb 10 месяцев назад
dont we need email templates in table an rows instead of div??
@colbyfayock
@colbyfayock 10 месяцев назад
hey can you elaborate on what you mean?
@ArysOakheart-qz2wb
@ArysOakheart-qz2wb 10 месяцев назад
i got it i just want to ask how to make this email template responsive in inline css like media queries or something @@colbyfayock
@mateusloubach
@mateusloubach 3 месяца назад
why can't I find the code you didn't bother writting for the video in your repo? the one with "isInputNamedElement".
@colbyfayock
@colbyfayock 3 месяца назад
hey what timestamp are you referring to in the video?
@mateusloubach
@mateusloubach 2 месяца назад
​@@colbyfayock Hey, thanks for the reply. At 12:39 you just pasted it in but didn't thoroughly disect it. What I'm trying to do is have a single click send out two notifications. ONE for my email saying "hey, on your website, {firstName} from {email} sent a meeting request", and another sent to the user that inserted those fields that says: "hey {firstName}. We've notified the team and they'll reach out to you shortly. how could I make that possible? - it seems the way you did this unfortunately forces the use of only ONE domain to be delivered.
@colbyfayock
@colbyfayock 2 месяца назад
@@mateusloubach ultimately you would need to invoke resend twice - one with each set of data you're looking for, which you would do in the API endpoint. if you need both of those pieces to be dynamic, you need to set up additional properties to be configured and passed through to the endpoint, otherwise you can statically define the 2nd set in the API endpoint pseudo code body: JSON.stringify({ userEmail, businessEmail }) ... await resend({ email: userEmail }) await resend({ email: businessEmail })
@mrkhan5138
@mrkhan5138 9 месяцев назад
Do I need a backend for this?
@colbyfayock
@colbyfayock 9 месяцев назад
you'll need a server-like environment but that can be a serverless function, so just depends on what you mean by backend
@matthewhammond4918
@matthewhammond4918 4 месяца назад
@@colbyfayock To echo this previous comment, I am currently trying to implement this functionality within a VITE react app and receive a CORS error when attempting to send the email. I wanted to avoid building backend as its a very small application but the Resend docs on CORS state that emails should be sent from the server side only. Is this then only achievable within NEXT due to its use of SSR?
@colbyfayock
@colbyfayock 4 месяца назад
@@matthewhammond4918 Next.js isn't the only option and you can choose a solution that doesn't include moving to a framework that supports API endpoints. You can manually create API routes that are framework agnostic in both Vercel and Netlify for instance. You can also create your API route using a cloud provider like AWS using their API Gateway and Lambda, or even a server environment if preferred. there's also api frameworks like Hono and Express, where which can be deployed to a variety of locations (see the sidebar here hono.dev/getting-started/basic) this would probably make for a good video!
@hbela1000
@hbela1000 9 месяцев назад
Cool, thx.
@colbyfayock
@colbyfayock 9 месяцев назад
np!
@ArysOakheart-qz2wb
@ArysOakheart-qz2wb 10 месяцев назад
how to use dynamic data from api in this
@colbyfayock
@colbyfayock 10 месяцев назад
you would pass it in to the component as shown around 10:00
@ArysOakheart-qz2wb
@ArysOakheart-qz2wb 10 месяцев назад
I mean I have an API to view posts in the email I have statically generated the data in a variable how to fetch data from an API in the email component or do I need to fetch that data somewhere else?
@colbyfayock
@colbyfayock 10 месяцев назад
@@ArysOakheart-qz2wb you can't fetch data from within an email, emails are statically delivered, so you would need to fetch any information before the email is generated, passing it as a prop to the email component
@ArysOakheart-qz2wb
@ArysOakheart-qz2wb 10 месяцев назад
can you please provide some example @@colbyfayock
@FBIIND
@FBIIND 10 месяцев назад
can you please provide some example i have a task of testing emails from dynamic data through api@@colbyfayock
@CRTechInformatica
@CRTechInformatica Год назад
thankyou
@colbyfayock
@colbyfayock Год назад
you're welcome!
@coddude3284
@coddude3284 6 месяцев назад
bro is better than docs !
@colbyfayock
@colbyfayock 6 месяцев назад
thanks 😁
@Anurag_Badwahe
@Anurag_Badwahe 2 месяца назад
Vercel domain is not verifying😢
@colbyfayock
@colbyfayock 2 месяца назад
hey are you referring to a [name].vercel.app domain? i wouldnt expect you do be able to send emails from a vercel subdomain like that. if you're referring to a primary domain that you added through vercel, that _should_ work, though it may take up to 48 hours i believe (doesnt usually take that long). what error are you seeing?
@Anurag_Badwahe
@Anurag_Badwahe 2 месяца назад
We don't allow public domain,please use your domain instead
@colbyfayock
@colbyfayock 2 месяца назад
@@Anurag_Badwahe whats the domain you're trying to verify?
@Anurag_Badwahe
@Anurag_Badwahe 2 месяца назад
feedonymous-vercel-app/ I replaced . With - ,because if i provide a link yt will.delete it
@Anurag_Badwahe
@Anurag_Badwahe 2 месяца назад
Really need help
@TYTAX_HOME_GYMS
@TYTAX_HOME_GYMS 10 месяцев назад
Colby everything is perfect only for people who does not speak English well (like me) could you speak a little bit slower :)
@colbyfayock
@colbyfayock 10 месяцев назад
yeah i get excited and have a habit of speaking quickly. thanks for the feedback! in the meantime maybe slowing it down with the player controls could help?
@wahaxoxo
@wahaxoxo Год назад
why am i getting this error: ./node_modules/@react-email/render/dist/index.mjs Attempted import error: 'convert' is not exported from 'html-to-text' (imported as 'convert2').
@colbyfayock
@colbyfayock 11 месяцев назад
not sure... i would recommend looking around on the React Email github and if not finding anything make an Issue github.com/resendlabs/react-email
@ilyasalir
@ilyasalir Год назад
why mine error { name: 'invalid_to_address', source: 'server', message: 'You can only send testing emails to your own email address (my email).' }
@colbyfayock
@colbyfayock Год назад
are you trying to use the resend email address? it's likely the case that they're only allowing you to test that email address sending to your own email so people dont abuse it. otherwise you need to set up your own email domain in your resend account
Далее
React Email with Resend (Complete Tutorial)
24:16
Просмотров 14 тыс.
They Fixed Email?? OMG
7:12
Просмотров 69 тыс.
🤔
00:28
Просмотров 276 тыс.
Send Emails with Next.js 13 - The Best & Easiest Way
16:10
Abort Fetch API Requests using AbortController
6:37
You Can Create Beautiful Modern Emails With React!
16:06
React Email First Look
11:21
Просмотров 83 тыс.
$1 vs $100,000 Slow Motion Camera!
0:44
Просмотров 25 млн
Battery  low 🔋 🪫
0:10
Просмотров 11 млн