How To Send Emails with React.js using Fetch (2024)

Published: 01 January 1970
on channel: Dev Drawer
678
21

Thank you to Mailtrap.io for sponsoring this video. Use the sponsor code DEVDRAWER to receive a free Mailtrap "10k Basic Email Sending" plan for a month.

Try Mailtrap for free: https://l.rw.rw/devdrawer

Continuing our previous React JS video, we will add an email send function to the previously created contact form. You can view the crash course on this URL:
React JS Crash Course:    • React.js Crash Course, Learn React in...  

Since React is JavaScript and does not process emails like server-side code (PHP, Node, etc), we have to make a call to an external location. For this tutorial, we will be using a simple PHP email function that is referenced in the React code using FETCH. This works the same way you would use it for an API. You have to worry about CORS, but if you are accessing the send file on your server, it is less important.

Essentially, you set up a typical PHP send function, and then call it from React. Easy.

🔗 Timestamps:
00:00 - Intro
02:18 - Create the PHP send function
14:00 - Sponsor: Mailtrap.io
15:26 - Add Fetch method
19:54 - Debugging and CORS
21:29 - Success

⭐ Programmer Merch: https://store.thedevdrawer.com/#!/

⭐ Join the Discord:   / discord  

⭐ If you would like to buy me a coffee because I created something that helped you, it would be much appreciated! : https://www.buymeacoffee.com/devdrawer

⭐ Join this channel to get access to perks:
   / @devdrawer  

⭐ Become a Patreon to show support and get exclusive access to content:   / devdrawer  

`````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Subscribe: https://bit.ly/2Wbsnj9
`````````````````````````````````````````````````````````````````````````````````````````````````````````````````````

Join us on our blog for video recaps and other tutorials: https://thedevdrawer.com
Become a fan on Twitter:   / thedevdrawer  

View Project on GitHub: https://github.com/thedevdrawer/sampl...


Watch video How To Send Emails with React.js using Fetch (2024) online without registration, duration hours minute second in high quality. This video was added by user Dev Drawer 01 January 1970, don't forget to share it with your friends and acquaintances, it has been viewed on our site 67 once and liked it 2 people.