Send Emails in Next.js App With Server Action & React.Email & Resend & TypeScript

Поділитися
Вставка
  • Опубліковано 16 жов 2024
  • 👉 NEW React & Next.js Course: bytegrad.com/c...
    Hi, I'm Wesley. I'm a brand ambassador for Kinde (paid sponsorship).
    👉 Add authentication to your app FAST: bit.ly/3QOe1Bh
    👉 NEW React & Next.js Course: bytegrad.com/c...
    👉 Professional JavaScript Course: bytegrad.com/c...
    👉 Professional CSS Course: bytegrad.com/c...
    👉 Discord: all my courses have a private Discord where I actively participate
    🔔 Email newsletter (BIG update soon): email.bytegrad...
    ⏱️ Timestamps:
    0:00 Explanation
    #webdevelopment #coding #programming

КОМЕНТАРІ • 42

  • @VaurionX
    @VaurionX 6 місяців тому +2

    This video was incredible. Not only did you teach us Server Actions, but you gave us all the extra goodies to make a really slick contact form. Thanks so much!

  • @eniskalyon
    @eniskalyon 10 місяців тому +1

    Yet another great video Grad, thank you for this. The portfolio tutorial overall was exceptional to say the least.

  • @damianalcalaylopez7229
    @damianalcalaylopez7229 Рік тому +4

    Hey Grad, thanks for the vid man!
    Do you know how to attach a pdf or image file to the email?

  • @heeeyyooou8714
    @heeeyyooou8714 9 місяців тому +2

    Hey Grad amazing video, btw how do you setup your domain to make it work on localhost?

  • @John-eq5cd
    @John-eq5cd 9 місяців тому +1

    Very good. A calm and clear explanation.

  • @mphatsomtogolo6263
    @mphatsomtogolo6263 6 місяців тому +2

    I did everything the same way but Im getting an error: Import trace for requested module:
    ./node_modules/resend/node_modules/@react-email/render/dist/index.mjs
    ./node_modules/resend/build/src/resend.js
    ./node_modules/resend/build/src/index.js
    ./app/actions/action.ts
    ./app/(public)/page.tsx
    ⨯ ./node_modules/resend/node_modules/@react-email/render/dist/index.mjs
    Attempted import error: 'renderToReadableStream' is not exported from 'react-dom/server' (imported as 'renderToReadableStream').

    • @Offiziersmesser
      @Offiziersmesser 4 місяці тому +1

      You probably forgot to place a 'use server' at the top of your sendEmail.ts file.

  • @souravukil4120
    @souravukil4120 Рік тому +1

    love your videos, also whats the name of the theme you're using!!

  • @LutherDePapier
    @LutherDePapier 2 місяці тому

    Can you try using !important to override the purple color on text?

  • @FaisalSaifi
    @FaisalSaifi 9 місяців тому +1

    I'm unable to open the attachments sent with Resend, they are getting broken although I tested that the Base64 encoding was just fine.

  • @pH7Programming
    @pH7Programming 11 місяців тому +1

    Great video! And very well explained 👌

  • @appstuff6565
    @appstuff6565 11 місяців тому

    Hi there Byte Grad! Thanks for this. What would you recommend : Amazon SES or Resend?
    Also, Im using nextjs 13 with supabase where i have to yet implement a reset password where i take in the email and send a "reset password" option to that email address. How would or should I go about this? Thanks in advance!

  • @eniskalyon
    @eniskalyon 9 місяців тому

    any ideas on how to implement a file/image upload functionality to this form? would we need any additional tech or library for this? I'm currently trying to achieve this by converting images to base64 on the client side but having too many runtime&rendering errors to deal with this in a proper way.

  • @jarekwasilewski8891
    @jarekwasilewski8891 Рік тому

    Hello, great video, can i use it with Astro and it has to be on SSR mode?

  • @kennycreator4800
    @kennycreator4800 Рік тому +1

    Hey, must i use Next JS? i am only familiar with React JS. Can i use it with regular React JS

    • @ByteGrad
      @ByteGrad  Рік тому

      Works outside Next.js too, for sure, but this example shows Server Actions (Next.js feature atm)

    • @kennycreator4800
      @kennycreator4800 Рік тому +1

      @@ByteGrad Thank you, so for the quick start i can just follow the Next.Js guide. Your channel is super helpful.

  • @psyferinc.3573
    @psyferinc.3573 7 місяців тому

    what did you do for deployment on vercel in order to get the react resend to work

    • @c4pancake
      @c4pancake 7 місяців тому

      in vercel you can go to setting > environment variables and input it there

    • @iliasrais9499
      @iliasrais9499 6 місяців тому

      @@c4pancake did it work for you? because i did that and it's not working

    • @c4pancake
      @c4pancake 6 місяців тому

      ​@@iliasrais9499it did at the time, make sure to redeploy

  • @Jimil_soni
    @Jimil_soni 2 місяці тому

    But what if I want to send the mail to other email rather than my own email

  • @ElijahScott10x
    @ElijahScott10x 9 місяців тому +1

    Great tutorial, thanks

  • @aashrith9680
    @aashrith9680 7 місяців тому

    How can I stop someone from spamming through tha contact form using resend ?

  • @Turin90
    @Turin90 Рік тому +2

    Amazing tutorial as usual 🚀. With react.js only does not work, cors error

    • @nirvanzentinal
      @nirvanzentinal 11 місяців тому

      also next.js how to handle cors?

  • @tossivahva
    @tossivahva 8 місяців тому

    I'm in a process but faced this error:
    "Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported."
    and
    400 error
    Because I pass react element I guess, idk, still googling solution.
    tried:
    - JSON.parse(JSON.stringify(data))

  • @KaranSethia24
    @KaranSethia24 10 місяців тому

    does it work with plain react?

  • @nidhinlalp5267
    @nidhinlalp5267 8 місяців тому

    will uploading files ? using this resend ?

  • @mikhacavin
    @mikhacavin 11 місяців тому

    can we user node mailer to this server action?

  • @LutherDePapier
    @LutherDePapier 2 місяці тому

    It's not about TypeScript not being smart, it's about the form data being able to be sent without the form and what would happen to your server if that's the case.

  • @sushantkumar3861
    @sushantkumar3861 Рік тому

    How did you verify the "localhost" in resend?

  • @jaguar3957
    @jaguar3957 Рік тому +1

    How to create a domain in resend ??

  • @psyferinc.3573
    @psyferinc.3573 8 місяців тому +1

    cant thank you enough,

  • @StasPonomaryov84
    @StasPonomaryov84 Рік тому

    hmm. hot working on production (Firebase). error 500

  • @leiyin1998
    @leiyin1998 10 місяців тому +1

    cool!

  • @sumitttpaul
    @sumitttpaul 8 місяців тому

    Failed in vercel

  • @gmancodes
    @gmancodes 7 місяців тому

    share code?

  • @alexeyyevkov155
    @alexeyyevkov155 11 місяців тому

    I faced an error styling the email component because next.js (13.4) recognizes react-email/components as client components. I found a solution on the Internet, specify in the next config that these components are server components.
    const nextConfig = {
    ...,
    experimental: {
    ...,
    serverComponentsExternalPackages: [
    '@react-email/components',
    '@react-email/tailwind'
    ]
    }
    };

    • @frontEndDiv
      @frontEndDiv 11 місяців тому

      my GOSH! I could kiss you. this was driving me nuts. thanks a lot.

  • @juanferrer5885
    @juanferrer5885 Рік тому

    - error AggregateError
    at RedirectableRequest.emit (node:events:511:28)
    at ClientRequest.emit (node:events:511:28)
    at Socket.socketErrorListener (node:_http_client:495:9)
    at Socket.emit (node:events:511:28)
    why me?