(FINALLY!) Email for Developers

Sdílet
Vložit
  • čas přidán 27. 07. 2024
  • Join the early access for my course! learnastro.dev
    - NEW Resend Features: • Best New Features of R...
    Modern email needs modern tooling for developers. Welcome, Resend! It's a breath of fresh air made better by it's companion tool, React email. I'll show you how to get Resend working in an Astro SSR project with dynamic json endpoints.
    🔗 Key Links 🔗
    - Github: github.com/coding-in-public/a...
    - Resend: resend.com/
    - Astro Dynamic endpoints: docs.astro.build/en/core-conc...
    - React Email: react.email/
    ---------------------------------------
    📹 Related Videos 📹
    - NEW Resend Features: • Best New Features of R...
    - React Email first look: • React Email First Look
    - How to send emails using Next.js App Router and Server Actions: • How to send emails usi...
    ---------------------------------------
    ⏲️ Timestamps ⏲️
    0:00 Introduction
    1:30 Project Setup
    2:07 Getting Started with Resend
    8:02 Dynamic call from frontend
    13:41 Getting Started with React Email
    ---------------------------------------
    🌐 Connect With Me 🌐
    - Website: codinginpublic.dev
    - Blog: chrispennington.blog
    - Twitter: / cpenned
    - Patreon: / coding_in_public
    - Buy Me a Coffee: www.buymeacoffee.com/chrispen...
  • Jak na to + styl

Komentáře • 111

  • @latch909
    @latch909 Před 8 měsíci +3

    Love the super speedy delivery actually - I can learn the big picture in one pass, plus note what I don't grok and go back and dig in. Appreciate your vids!

    • @CodinginPublic
      @CodinginPublic  Před 8 měsíci

      Thanks for the feedback! Yes, that was my intention. Just trying to quickly show possible use cases since email implementation is always so personal. Glad you liked the faster-than-normal delivery.

  • @7doors847
    @7doors847 Před 8 měsíci +8

    Chris, you’re still going strong, that’s awesome to see.
    Very well deserved.

  • @simonswiss
    @simonswiss Před 8 měsíci +5

    You are absolutely KILLING IT with this CZcams channel - learning so much from you 🙏🙏🙏

    • @CodinginPublic
      @CodinginPublic  Před 8 měsíci +1

      Simon! That means so much coming from you. Thanks, man! Now I just finally need to get around to doing some Keystatic content! 😉

  • @teinett
    @teinett Před 8 měsíci +1

    Thank for the video!
    Everything happens so quickly in this video. At first I even thought that my playback speed was x1.5. Previous videos were not as fast and therefore more understandable from the first viewing.

    • @CodinginPublic
      @CodinginPublic  Před 8 měsíci

      Yeah-it was definitely a faster delivery-especially after the first 5 steps. Sorry it felt a little fast, but I was mostly just wanting to show possible use cases since it's so personal to the user. Thanks for the feedback!

  • @heyjitendra
    @heyjitendra Před 8 měsíci +1

    Wow Chris Awesome explanation. Resend does solve a lot of issue.

  • @adnanamin3666
    @adnanamin3666 Před 8 měsíci +4

    Amazing. Finally something good in emails. Thanks Chris, for covering this.
    BTW, what's that icon pack and theme you're using? Will you please share the extebsion names?

  • @gstreetgames2530
    @gstreetgames2530 Před 8 měsíci +12

    Oh boy, of all my years developing web and game software, all I ever thought about was "Damn I wish upon a star that this development work could be made easier and faster when it comes to emailing. If only my time spent emailing people could be improved, I wouldn't need to be sitting at the computer for hours every day." Yeah, the email client that I use was always at the top of my list of desires as a modern programmer!

    • @abhimohan4356
      @abhimohan4356 Před 8 měsíci

      Lol? Google Outreach, and think about why an email client would be worth over 4 billion dollars.

    • @CodinginPublic
      @CodinginPublic  Před 8 měsíci

      Ha, sounds like you have a lot more dev experience than me :)

    • @Action2me
      @Action2me Před 7 měsíci

      That sounds like sarcasm. Is it? Because honestly I wholeheartedly agree with this comment if it’s sincere.

    • @TheGuillotineKing
      @TheGuillotineKing Před 7 měsíci

      It's obviously sarcasm

    • @p0xygen
      @p0xygen Před 6 měsíci

      @@CodinginPublic Yeah sounds like he does

  • @humbulanimunyai9981
    @humbulanimunyai9981 Před 8 měsíci +1

    This awesome

  • @rubenzafratraver6819
    @rubenzafratraver6819 Před 8 měsíci +2

    One unrelated question (a bit). How would you approach an astro project that requires animatios with gsap or framer motion? Would that just ship the HTML static and then ship the necessary js even if its on the layout component? Like doesnt that mess up with the Astro idea? I really want to use astro but Im a bit afraid that this is working against me, thanks!!
    Love your videos btw!!!

    • @CodinginPublic
      @CodinginPublic  Před 7 měsíci

      Yeah, that would work! Just set it up like you would in a static HTML site. That's what I'd do :)

  • @abacuswithrehan264
    @abacuswithrehan264 Před 8 měsíci

    Awesome Video, Astro looks interesting as a Next.ts Dev, BTW how did you got the object shown in vscode when it's logged in console 👀

    • @CodinginPublic
      @CodinginPublic  Před 8 měsíci +1

      Glad you enjoyed it! Yeah, Astro has a lot of interesting use cases. It’s better at some things than NextJS IMO, but obviously Next has its own strengths. I did a quick 20 crash course a while back that still holds up here:
      czcams.com/video/zrPVTf761OI/video.html
      Console log is an extension called Turbo console log.

  • @rayandedoschevic2884
    @rayandedoschevic2884 Před 6 měsíci +1

    Resend works in dev mode but when I put it in production (Vercel) contact form gives me 405 error. Also I am not using React, Preact....just pure Astro.
    Any advice?

  • @badcatdesign
    @badcatdesign Před 8 měsíci +1

    Email is hard. You make this look easy. I'll still stick with MJML though - "slightly less" setup :)

    • @CodinginPublic
      @CodinginPublic  Před 8 měsíci +1

      lol I’ve used MJML once but found it clunky. It’s been a bit though and I’m better with react now, so it may have been my fault :)

    • @badcatdesign
      @badcatdesign Před 8 měsíci

      @@CodinginPublic Clunky is kind. But there's 100% less setup time which is a plus for me.

  • @amayweather
    @amayweather Před 7 měsíci

    Its looks great, i really wait when C# will be added

    • @iWhacko
      @iWhacko Před 7 měsíci

      if you need a tool like this then take some more programming lessons. The "problem" this tool is trying to solve is non-existent. It's ridiculously easy to send emails in most languages, even with templating engines. instead of static html.

    • @amayweather
      @amayweather Před 7 měsíci

      chill man .i am seeking a service the functionality that i needed , it rather than building your own solution. and i know that in most of langs you can code sending email)

    • @CodinginPublic
      @CodinginPublic  Před 7 měsíci

      They move fast, so hopefully soon!

  • @otisrancko
    @otisrancko Před 8 měsíci

    I am never using Google's API again after this....there tokens expiring and recurring payments were expensive for small projects. This is useful piece of content!!!

  • @finnjennings6675
    @finnjennings6675 Před 4 měsíci

    I am a front-end freelancer who recently built a couple simple SPA's with astro but am having a hard time understanding the backend parts of this tutorial. Any ideas on where I should begin?

  • @FilledStacks
    @FilledStacks Před 7 měsíci

    this looks dope!

  • @none4614
    @none4614 Před 7 měsíci

    Hi Chris. Thanks for your interesring video. Which 3rd parties in your terminal setup ? ❤

    • @CodinginPublic
      @CodinginPublic  Před 7 měsíci +1

      I use fig.io in VSCode and Warp as my standalone terminal :)

  • @naked_avocado
    @naked_avocado Před 8 měsíci +1

    Didn't understand cos im new to front-end
    But sill awesome

    • @CodinginPublic
      @CodinginPublic  Před 8 měsíci +1

      Hey, no worries! I moved much faster here than I normally do on my channel, but glad you still enjoyed it! Thanks for saying something!

  • @voidbinary
    @voidbinary Před 7 měsíci

    As one that had to deal with email automation for several years. There only are two crucial issues why E-Mail Templates are a pain.
    1. Outlook rendering HTML with the Word HTML renderer and the implied chaos of older Outlook versions
    2. Clients never updating their clients forcing us to support the stone age rather than standards.

  • @user-se9kc8pt1i
    @user-se9kc8pt1i Před 7 měsíci

    How did you theme your terminal? Any link? And thanks a lot for helping the community.

    • @CodinginPublic
      @CodinginPublic  Před 4 měsíci

      My prompt is using starship I think? I don’t know if I have a tutorial on it, but it’s fairly easy to setup from their site.

  • @spacecoder0526
    @spacecoder0526 Před 6 měsíci +1

    My astro project shows `Named export 'html' not found. The requested module 'js-beautify' is a CommonJS module, which may not support all module.exports as named exports.
    CommonJS modules can always be imported via the default export, for example using:
    import pkg from 'js-beautify';
    const { html } = pkg;` this error after I followed @7:37 . i don't know how to fix it...

    • @wojtek6206
      @wojtek6206 Před 6 měsíci

      I'm facing the same problem. No idea how to fix it 😕 I've also upgraded Astro but it didn't help.

  • @joaooliveirarocha
    @joaooliveirarocha Před 6 měsíci

    we started with react-email but at the time (start of last year) it didn't work that well: the , and other components didn't work. Also we were supposed to use only inside s but there was no documentation on it, etc. We end up ditching it and work around with `react-dom`, some dangerously-set-html, liquid.js parseSync and some custom rules and works perfectly. I don't know how react-email had 8k stars on GH at the time... I doubt even 5% of those stars actually tried the library

  • @FaizanAnwerAli
    @FaizanAnwerAli Před 8 měsíci

    I wonder if it is sending multiple requests to server API for each email or one requests to server API to send all emails at once from backend.

    • @CodinginPublic
      @CodinginPublic  Před 8 měsíci

      Right now, the way I'm showing it, it's a single request for each email. So for bigger use cases you'd probably want to do a lot of this logic on the server and send something smaller over the network. So just a quick example, not the be-all end-all.

  • @Zagoorland
    @Zagoorland Před 7 měsíci

    what do you use for terminal settings, theme and autocomplete?

    • @CodinginPublic
      @CodinginPublic  Před 7 měsíci +1

      fig.io in the VScode terminal. I'm using a custom starship prompt. And I use Warp as my standalone terminal. Hope that helps!

  • @brx-hashcode
    @brx-hashcode Před 8 měsíci +1

    Please Chris which Vs Code theme are you using?

    • @CodinginPublic
      @CodinginPublic  Před 8 měsíci

      Material Palenight High Contrast: marketplace.visualstudio.com/items?itemName=Equinusocio.vsc-material-theme

    • @brx-hashcode
      @brx-hashcode Před 8 měsíci

      Thank you Chris!

  • @ricardoduarte442
    @ricardoduarte442 Před 7 měsíci

    How would you handle the api so that only requests from your website can be authorized? It would be a problem having user just hit that POST Route and sending from your email whatever they want.

    • @IainSimmons
      @IainSimmons Před 7 měsíci

      Yeah you'd want it behind auth, of which there are many options, the simplest being a login and cookies (handled on the server of course)

    • @CodinginPublic
      @CodinginPublic  Před 7 měsíci +1

      Like Iain said :). I did mention in the video that you'd want to set this up behind auth, but didn't want to set all that up to just stay focused on Resend in this video.

  • @AndresMartinez-se9zl
    @AndresMartinez-se9zl Před 3 měsíci

    Would it work with ssg? I just need resend for a contact form.

    • @CodinginPublic
      @CodinginPublic  Před 2 měsíci

      Sure! You could have your page rendered in SSG. But to protect your api key, you’d want to hit a server endpoint that’s protected. Astro’s hybrid rendering would be great here. The whole site will be SSG but you could mark the api POST route as prerender=false to make it alone SSR.

  • @Goku-xm1gq
    @Goku-xm1gq Před 7 měsíci

    Can you tell me one thing, isn't storing apikey on.env on the browser side is risky? i mean .env will rendered as string , if someone looked at source, right ? What is preferred way of making it opsec safe ?

    • @digletwithn
      @digletwithn Před 7 měsíci

      Everything that should be private shouldn't be, in any way, in the client code.
      You might need to make a server that makes the api calls for you

    • @IainSimmons
      @IainSimmons Před 7 měsíci +1

      It's not in the browser. Astro is server first, and those API endpoints he's making are all server side, and only return JSON in the response

    • @CodinginPublic
      @CodinginPublic  Před 7 měsíci +2

      As Iain mentioned (and I may not have been clear enough) the API endpoint is server -only. And Vite protects you from exposing keys by forcing you to name client-side keys as PUBLIC_{KEYNAME}. Hope that helps!

    • @Goku-xm1gq
      @Goku-xm1gq Před 7 měsíci

      @@CodinginPublic One more thing thats vite specific ... so I tried with vite app and named .env keys as VITE_APP_{}. I see that as rendered string and their docs says if you write it like this it will not leak anything.

    • @digletwithn
      @digletwithn Před 7 měsíci

      @@CodinginPublic Btw maybe you know if there's any reason to go from SendGrid to Resend? Pricing is exactly the same and I do not have any problems with SendGrid

  • @elieobeid77
    @elieobeid77 Před 7 měsíci +51

    sending emails from the frontend is a bad idea, if the user closes the browser before the email is being sent then the email wont be sent. If the user has adblocker or something, it might cause js issues and the email wont be sent. It's just a bad idea to do any business logic from the frontend. Also I don't understand the point of Resend, we already have Sendmail and Maillgun etc.

    • @iKyroja
      @iKyroja Před 7 měsíci +2

      True, nothing to add here.

    • @matt_hart
      @matt_hart Před 7 měsíci +2

      where is he sending emails from the frontend?

    • @aberba
      @aberba Před 7 měsíci +1

      Email will be sent but won't see response. Yes, it's not a good idea, to send from frontend. This video isn't sending from frontend though. He's using an API route.

    • @jchiatt4
      @jchiatt4 Před 7 měsíci

      No one is sending email from the frontend, relax buddy

    • @CodinginPublic
      @CodinginPublic  Před 7 měsíci +1

      Hey, I may not have been clear enough in the video, but like I mentioned, you'd want to set up an authenticated route if you want to send emails like this. You'd likely also want to add an API key or some kind of internal check server-side for the actual call to send the emails. Just didn't want to set all that up in this example to show off Resend. Thanks for the comment.

  • @guyman8282
    @guyman8282 Před 8 měsíci

    what font are you using in vscode

  • @alexisviscogliosi2785
    @alexisviscogliosi2785 Před 6 měsíci

    Their approach is wrong, because it locks you. Just the last week we were in outage with our mail provider and we were using their apis (like resend, nothing new btw) and the fact that we were using the API blocks us to switch email provider. Now, I will use mjml + smtp protocol. In that way we can switch to any mail provider.

  • @jairo9super4
    @jairo9super4 Před 7 měsíci

    Great, could you show how to deploy what you just created? It's simply an "npm run build" and upload it to the hosting and that's it? I'm a little lost with that

    • @CodinginPublic
      @CodinginPublic  Před 7 měsíci

      You'd want to hide this behind authentication before publishing, so that's why I didn't show :)

    • @codebreaker2495
      @codebreaker2495 Před 6 měsíci

      @@CodinginPublic I'm stuck in that, i wanted to deploy it to Netlify or Vercel, but when i run npm run build, it returns 2 folders inside "/dist", /client & /server, but there's no index file (.html), so when i deploy it, i get a 404 not found, could you explain me how to make a deploy correctly please?

  • @duckdev9447
    @duckdev9447 Před 5 měsíci

    Any improvements from nodemailer?

    • @CodinginPublic
      @CodinginPublic  Před 5 měsíci

      It would be worth looking at their docs, but they do a lot of stuff for DKIM and other email requirements to ensure your emails actually land in people’s inboxes. It's not perfect, but they take care of all of that for you.

  • @V1kToo
    @V1kToo Před 8 měsíci

    Is this just for React?

    • @CodinginPublic
      @CodinginPublic  Před 8 měsíci +1

      React email is. But resend is for any rendered HTML.

  • @ahsanhabibasha6906
    @ahsanhabibasha6906 Před 6 měsíci

    Chris, Can you copy the Rubik's Cube and make a video of it.

    • @CodinginPublic
      @CodinginPublic  Před 6 měsíci +1

      I wish! That's probably more complicated than I could neatly explain. Guessing ThreeJS?

    • @ahsanhabibasha6906
      @ahsanhabibasha6906 Před 6 měsíci

      Thank you so much for telling me. I will try this framework to make this project.@@CodinginPublic

  • @rhbvkleef
    @rhbvkleef Před 6 měsíci

    I still don't understand why so many people are opposed to just sending an email over SMTP. It's not that hard.

    • @CodinginPublic
      @CodinginPublic  Před 5 měsíci

      I didn't really outline this in the video, but Resend takes care of a bunch of other items as well like DKIM, the new Google and Yahoo email policies, etc. So your emails are much more likely to land in people’s inboxes without a bunch of work on your part. You can also use SMTP with Resend. But if you have another solution, no worries. Cheers!

  • @user-cw4fh5bd2p
    @user-cw4fh5bd2p Před 7 měsíci

    Bro, the cube awesome, 😎, Threejs ?

    • @CodinginPublic
      @CodinginPublic  Před 7 měsíci +1

      Idk. It’s pretty cool though!

    • @user-cw4fh5bd2p
      @user-cw4fh5bd2p Před 7 měsíci

      @@CodinginPublic love your work ❤️, astro js awesome videos thanks 🙏

  • @JR-mk6ow
    @JR-mk6ow Před 7 měsíci

    React Email is "ok" now? I've started using it (it had like 8k stars on GH already) and it wasn't that good: Fonts didn't work, the Column component was to be used inside a Column (and there was/is no documentation about it). Everything was so badly polished that I end up re-writing most of the rendered / components.
    It wasn't that good honestly.

    • @CodinginPublic
      @CodinginPublic  Před 7 měsíci

      I should have mentioned that it's still in beta. I agree that it could be better, but transparently I haven't used a lot of the other email systems :)

  • @_nom_
    @_nom_ Před 7 měsíci +2

    There's always been easier ways. They just cost.

  • @bugged1212
    @bugged1212 Před 6 měsíci

    Meh, sending email has never been an issue, this does not look any different from Postmark or sendgrid or any of the services out there. The pain point has always been being able to create an email template that works in all the email clients. If one is just going to use react email, then one could send an email from any service including just from node.

    • @CodinginPublic
      @CodinginPublic  Před 4 měsíci

      I didn’t really feature this in the video, but the resend takes care of DKIM and a bunch of other email domain requirements for sending emails that actually land in people’s inboxes. The new broadcast feature also adds appropriate headers that Google and yahoo now require (new requirements in the last couple of months). Again, you can roll your own, but I’m happy to use resend so I don’t have to. I agree that templating is the worst tho! Ha

  • @shreyassk1515
    @shreyassk1515 Před 6 měsíci

    Is it free?

  • @iWhacko
    @iWhacko Před 7 měsíci

    if you need a tool like this then take some more programming lessons. The "problem" this tool is trying to solve is non-existent. It's ridiculously easy to send emails in most languages, even with templating engines. instead of static html.
    also I see some blatant security issues here.

    • @CodinginPublic
      @CodinginPublic  Před 7 měsíci

      You may not be willing to, but I'd encourage you to look more into what Resend is offering. I focused on the sending of emails here, but the easy-of-use is actually in how they help you quickly configure your domain to avoid spam filters, DKIM, etc. And as to the security issues, like I mentioned in the video, you'd want to put this all behind auth, etc.

  • @jordixboy
    @jordixboy Před 7 měsíci +2

    another overpriced saas that wont exist in 1-2 years.

    • @CodinginPublic
      @CodinginPublic  Před 7 měsíci

      We’ll see. Time will tell! I’m really enjoying it!