Creating A Contact Form With JavaScript / Nodemailer

Поделиться
HTML-код
  • Опубликовано: 27 ноя 2024

Комментарии • 189

  • @maxvegra4628
    @maxvegra4628 2 года назад +3

    MATE MATE MATE MATE MATE! where was you?? after three days finally found you and my problems got fixed ohhhhh my GOD! thank you pretty much.. appreciate man. best of luck!

  • @radovanbotik
    @radovanbotik 2 года назад +6

    Hey Conor, Thank you very much for this tutorial. This has been the first time I touched anything remotely close to backend, I spent entire evening trying to implement this, watched 5 different tutors but this is the one I was actually able to follow. I conquered this on my 3rd rewatch after getting little bit more familiar with nodemailer documentation, so thanks to YOU my contact form is running strong without 3rd party services! 🔥🔥

    • @my.code.studio
      @my.code.studio 11 месяцев назад

      @radovanbotik im tryin to add this contact form to my website and just haye 2 questions 1. how to hide the credentials of the email and pass and 2. can i run this together with my html css website. sorry im a beginner

  • @IrajFatima-d7b
    @IrajFatima-d7b 3 месяца назад

    I had been stuck with this form for three solid days and I tried 5 tutorials from youtube and used 3 AIs but nothing worked. your method worked well. Thannkyouuu so muchhh

  • @rshelfo1
    @rshelfo1 2 года назад +5

    I would like to say that this has been one of the most informative videos a novice dev like myself has ever watched. Everything just worked perfectly, and you. covered every aspect, rather than just the app, or the form etc.
    Thankyou, please keep doing what you are doing

    • @lukelittler60
      @lukelittler60 2 года назад

      Most informative for a complete beginner, this is the first ever JavaScript I've worked with don't understand it much yet but this is exactly what I needed for my demo website for college a functioning contact form. All the others just show you how to make one in html and CSS, like where does the info get sent to man. This guy solved that for me!

  • @davidsuchan1641
    @davidsuchan1641 3 года назад +5

    This is the most useful tutorial on contact form with node.js i could have found. Thank you a lot sir!

  • @forrestvanduren3440
    @forrestvanduren3440 2 года назад +3

    Interesting I always assumed when I sent emails to companies using these forms that it was actually sent from my email. Kind of funny that it's just an email they're sending to themselves. I guess you would need access to each person's actual email accounts to have it sent from their account itself though, so this actually makes a lot of sense. Thanks.

  • @liu-river
    @liu-river 2 года назад +2

    As of May 2022 Google stopped option for less secure app, but we can setup app password and this works still. Great tutorial.

  • @Jay-dy4dh
    @Jay-dy4dh 3 года назад +11

    Me after days of searching: A video which is detailed, no ads and has exactly what I need doesn't exist
    Conor Bailey: Hold my Beer...
    (Old meme but true)

    • @ConorBailey
      @ConorBailey  3 года назад +1

      Haha! Thank you mate! Glad it helped!

  • @coding-uj3kl
    @coding-uj3kl Год назад

    i tried all methods , yours is the only one that worked.THANKS!!!

  • @claytorresgaming7212
    @claytorresgaming7212 Год назад

    Finally! After searching the internet of a Nodemailer Tutorial that includes a Frontend implementation example! Thank you for this, it really helped me with my project! Keep doing more videos like this. Subscribed!

  • @michealocathain944
    @michealocathain944 2 года назад +1

    Excellent walk-through! Just what I needed to get my head around both the form front end and server backend. Thanks!

  • @scriptkeeper8243
    @scriptkeeper8243 2 года назад +1

    You did a great job with the step by step proceedural code here showing how to effectively debug along the way. Thank you.

  • @peterkabiru5144
    @peterkabiru5144 Год назад

    Thank you Conor, well explained on this one. I'm a beginner but It feels good to div deeper and get to know exactly how things are done in the back. I like things from scratch

  • @dieviktoria
    @dieviktoria 4 года назад +7

    Thank you! I was searching for a video explanation on this exact topic! You helped me a lot!👍

    • @ConorBailey
      @ConorBailey  4 года назад

      Awesome! Glad it helped and thanks for watching! 😃

  • @thunderbolt4777
    @thunderbolt4777 2 года назад +1

    great tutorial man. cleared a lot of my misunderstandings up!

  • @Frankslaboratory
    @Frankslaboratory 4 года назад +4

    Hi Conor, nice work with these tutorials, very clear and easy to follow

    • @ConorBailey
      @ConorBailey  4 года назад +1

      Thanks Frank. Really like your channel dude. Great stuff!

  • @joseluisvegavargas5275
    @joseluisvegavargas5275 3 года назад +3

    this is great, it work 100% guaranteed. I used this method for my Contact me form. Could be great have a video about how to do validation form.

    • @ConorBailey
      @ConorBailey  3 года назад +1

      Thanks Jose. I may look to do a form validation tutorial in future. Although you should check out Florin Pops RUclips channel. He has a good form validation tutorial with JavaScript. All the best!

    • @ConorBailey
      @ConorBailey  3 года назад +1

      ruclips.net/video/rsd4FNGTRBw/видео.html

  • @Ahmedahmed-qg5ep
    @Ahmedahmed-qg5ep 2 года назад

    Thank you so much. I was searching for it the whole day

  • @Mark2TheWorld
    @Mark2TheWorld 3 года назад +1

    Sir Conner Bailey,
    I pressed the like & subscribe button thrice using my thumb like👍👍👍

  • @matijabarbir3466
    @matijabarbir3466 Год назад

    I love you, that was the most perfect tutorial I have ever seen.

  • @tasteoftheair
    @tasteoftheair 3 года назад +1

    This video is gold! Can't thank enough! Wish you all the best!

    • @ConorBailey
      @ConorBailey  3 года назад +1

      Thanks Anna! Glad it helped.

    • @tasteoftheair
      @tasteoftheair 3 года назад

      @@ConorBailey I want to use this feature from the video for my website, really have nothing to add or to change. Can I do it?

  • @sudodr
    @sudodr 8 месяцев назад

    I'm so lucky to discover this channel bro!❤

  • @charlesadah5929
    @charlesadah5929 2 года назад

    Thanks man, I really appreciate your short and straight explanation, by the way it worked on my system.

  • @kensleylewis4601
    @kensleylewis4601 3 года назад +4

    With this exact setup, how can we integrate either Google Recaptcha v2 or v3 into this project? Can you come out with a video on how to do that?

  • @sofibilal193
    @sofibilal193 3 года назад

    Thanks, found the best video send mails....Again Thank you very much ❤️❤️❤️

  • @davebudah
    @davebudah 3 года назад +1

    Thanks man, this is something I was specifically looking for.

  • @zoltancaputo9562
    @zoltancaputo9562 2 года назад

    Awesome class! TKS

  • @tetianabronitska6688
    @tetianabronitska6688 3 года назад

    Very useful video! Thanks a lot from Ukraine!!!

  • @autopilot6942
    @autopilot6942 2 года назад

    Thank you very much that was easy to understand and I got mine worked as well. chheeeers

  • @kensleylewis
    @kensleylewis 3 года назад

    This was a fun learning exercise. There are some really good tips to take from here. But I would say that if forms are the task at hand, validation and sanitization should be the most important aspect to centralize the project around. From there everything is gravy.

    • @tobiasbenson3234
      @tobiasbenson3234 3 года назад

      i guess Im asking the wrong place but does anyone know of a tool to get back into an instagram account..?
      I stupidly forgot the login password. I love any tricks you can give me.

  • @tootyrnt5533
    @tootyrnt5533 3 года назад +2

    Quick question, why did Gmail show the email sender as yourself but the custom email showed the email sender as what you put in the form field?

  • @aitoufkirbrahim9278
    @aitoufkirbrahim9278 2 года назад

    great job

  • @maniac1441
    @maniac1441 2 года назад

    thankyou. it is really usefull

  • @eddyozz
    @eddyozz Год назад

    Noticed if your using Gmail, you might have to set password as ‘application specific’. You set this up in your gmail account settings.

  • @randomcell708
    @randomcell708 3 года назад

    Nice Video Conor, really clear and consise explanation

  • @nicolasgula1353
    @nicolasgula1353 3 года назад

    Great tutorial!! the only one I found that worked, thanks men!

    • @ConorBailey
      @ConorBailey  3 года назад

      Nice one mate. Glad it helped

  • @vickytemp3878
    @vickytemp3878 3 года назад

    Thank You so much! This is exactly what I was searching. :D

  • @TarikulIslam-nj7vr
    @TarikulIslam-nj7vr 4 месяца назад

    Thank you..... Its working 😊

  • @sayakrana3984
    @sayakrana3984 2 года назад +1

    25:26 in console.log(req.body) not working because there are more items besides form.so, what to do? Please help 🥺

  • @hiphiphorhayy
    @hiphiphorhayy Год назад

    I’m gonna watch this in it’s entirety soon but does it cover back end input validation as well?

  • @nickfischer8205
    @nickfischer8205 3 года назад

    Thanks for doing this video! Super helpful

  • @SO-xs6wu
    @SO-xs6wu 3 года назад

    Good work

  • @deadvilla2612
    @deadvilla2612 3 года назад +1

    I am getting an error when trying to run npm run dev [nodemon] 2.0.12
    [nodemon] to restart at any time, enter `rs`
    [nodemon] watching path(s): *.*
    [nodemon] watching extensions: js,mjs,json
    [nodemon] starting `node server.js`
    [nodemon] clean exit - waiting for changes before restart
    can you help me

  • @MicroUrb
    @MicroUrb 2 года назад

    I am getting 'name' is deprecated for the XMLHttpRequest and I am assuming as a result, I am not getting Email Sent.

  • @samarthpandey510
    @samarthpandey510 3 года назад

    great content helped a lot man thanks for this great tutorial!

  • @philipjobran2716
    @philipjobran2716 2 года назад

    FINALLY FUCKIN WORKED !! THX MAN APPRECIATE IT SO FKN MUCH !

  • @user-tt6nc6mo7k
    @user-tt6nc6mo7k 4 года назад +1

    You really did go old school with the XHR lol. I'm a bit confused as to why its necessary to provide the password of your email address? I have created a php script in the past to handle contact form submissions and did not need to enter an email password.

  • @SM-kk1xs
    @SM-kk1xs 3 года назад +1

    Thanks a lot for this. Do u know how can I read and store msg in nodejs if the user responds to this email??

  • @rominaprograma
    @rominaprograma 2 года назад

    you saved my life

  • @anwartobji1410
    @anwartobji1410 3 года назад

    great content ,thank you.

  • @lktech8199
    @lktech8199 3 года назад

    Really I love this ❤️

  • @puneethchidambar2128
    @puneethchidambar2128 2 года назад +1

    Thank you it's a great video. I'm not getting the mail ID which filled in the contact form. instead I'm getting the mail ID used for user and password. text and Subject are coming to mail properly. please help me on this.

    • @iprogram4486
      @iprogram4486 2 года назад

      Same here pls help out😭😭

  • @balazshorvath9057
    @balazshorvath9057 Год назад

    Hi! First of all really great tutorial, great content, you explained perfectly. My question is that what do i have to do differently if im running on the web, not on the localhost? Thank you for your answer!

  • @adamearl333
    @adamearl333 Месяц назад

    how did you do that quick paste of .form-container?

  • @samsonoduori7816
    @samsonoduori7816 3 года назад

    thanks so much. really helpful

  • @ET_Bermuda
    @ET_Bermuda 3 года назад

    Works great!! Thx so much!

  • @adityarai344
    @adityarai344 3 года назад +2

    Thanks for the tutorial I really enjoyed it! I had a slight issue while running the app.js file. The onload function does not seem to fire, and I am unable to clear the form fields are submitting. I tried console logging inside the onload function to check if its firing or not and its not showing up in the console which confirms my doubt. However, I am successfully able to send the emails. Any ideas on what I am doing wrong?

    • @j3ro3n16
      @j3ro3n16 3 года назад +1

      For others with the same issue, please complete all steps of the tutorial before testing the onload function (i.e. first send emails correctly).

  • @gavincoulson3900
    @gavincoulson3900 3 года назад

    loved the vid! didn't fully understand why you went the fetch route when the action route would do the same thing no? unless my newbie ways are leading me astray haha.

  • @ukaszzbrozek6470
    @ukaszzbrozek6470 2 года назад

    There is no point of targeting all those fields in form. You could get all that data from the Event object. It should contained it as dataForm that can be send instead of JSON. You could also use fetch on the FE witch is way easier to use.

  • @Mast3rOfPupp3ts13
    @Mast3rOfPupp3ts13 3 года назад +1

    Thanks for this, it was exactly what i needed. But i am having trouble getting the req.body.message to show up in the emails. The emails are being sent which is good, but theres just no message

    • @ConorBailey
      @ConorBailey  3 года назад

      Hi mate. Did you use the app.use(express.json) middleware? What gets logged when you console log the req.body in your server code?

    • @Mast3rOfPupp3ts13
      @Mast3rOfPupp3ts13 3 года назад

      @@ConorBailey yes I have app.use(express.json()). the name:, email:, and message: does get logged correctly. Everything seems to be ok, i get the success log in the browser and receive the email. But it never shows the senders email or message. It only shows my own gmail when i receive the message. Also, i was wondering if theres any downside to turning off the gmail less secure app access setting? I will only be using this for my portfolio page. Thanks for getting back to me
      ***** Hey Connor, i actually just got it to work lol I have 0 idea what i did differently , but i think it might have been something to do with nodemon. i changed a few things, made sure to end the server before starting it up and trying again and it worked. Thanks again!

    • @unknownyoutuber5759
      @unknownyoutuber5759 3 года назад

      Can you please help me i have a similar problem i just can’t get the email and the subject instead i just get the req.body.email nothing else i really need to finish this soon my deadline is tomorrow and i have no idea what to do

  • @sajjjadhossain1907
    @sajjjadhossain1907 3 года назад

    thanks a lot ,, love u brother

  • @oliverturp8667
    @oliverturp8667 3 года назад

    If I had two different forms, would I need to make all this twice or could I use the same server for two different forms?? Looking to set up a contact form like this but also a feedback form too 🤔🤔

  • @francisabounader331
    @francisabounader331 3 года назад +1

    hello i have a question this tutorial will work in a react app?

  • @noahg2
    @noahg2 2 года назад

    when posting the function runs when the form is submitted till the xhr.onload function and stops, any help ?

  • @md.fakweruddinmazumder4668
    @md.fakweruddinmazumder4668 Год назад

    Thank you very much

  • @bartoszjasinski9485
    @bartoszjasinski9485 2 года назад

    Hi. I have watched your tutorial several times and thank you. I am just in a trouble of receiving actual massage ( I receive only subject on my gmail ) .
    Also have struggle with receiving the '' email sent'' confirmation and clearing page.
    Would you advise me something ? thank you .

  • @Newviewgraphics
    @Newviewgraphics 3 года назад

    your middleware is not working on my end?? wondering if there is a different syntax?? I get two errors saying ',' expected and ':' expected. why is this??? can you help @ Conor Bailey

  • @codeitraw5241
    @codeitraw5241 2 года назад

    man thanks so much, it works!!

  • @alexandrecveticanin5188
    @alexandrecveticanin5188 4 года назад +1

    Hey potatoes 😁
    Do you any ideas for christmas gifts for Natacha ?
    A secret admirer

  • @nan096-l1f
    @nan096-l1f Год назад

    Hi i Want to send the resume as part of the mail , but as we are converting the response into string it is becoming unusable in the back end. Do you have any solution for this

  • @richard1403
    @richard1403 3 года назад

    how would you do this by removing the form keeping only the send button to trigger an email and then building a templated email that never changes but pulls the clients email from a database

  • @crusaderpr7683
    @crusaderpr7683 Год назад

    need help when i enter npm run dev it cant find the server.js i check the package and the writing is fine
    when i try run the server this message pops up [nodemon] app crashed - waiting for file changes before starting...

  • @ajaypartapdhaliwal7346
    @ajaypartapdhaliwal7346 3 года назад

    Hey, i used ur method and it seems to be working when i used npm dev run and localhost however i tried using firebase to run this and it wouldnt let me send out the emails any idea why?

  • @HueMannKind
    @HueMannKind 3 года назад +1

    Thanks for the video! I am running into a snag where the xhr onload never gets called. Any idea why that might happen?

    • @HueMannKind
      @HueMannKind 3 года назад

      I have also tried to do the same thing with ajax but I get a 500 internal server error and do not know why.

    • @ConorBailey
      @ConorBailey  3 года назад

      Hey mate. Do you have your code posted on GitHub? I could take a look. Have you set the method to “post”? And is this set up as a route on your server?

  • @thodoris2243
    @thodoris2243 2 года назад

    nice video. what about subscription to newsletters? How would you tackle that? any useful tool?

  • @syrahsommeliers
    @syrahsommeliers 3 года назад +1

    Amazing video! Conor, is there a way to redirect to a success page?! thanks a lot man!

  • @jihadnawzad8899
    @jihadnawzad8899 3 года назад

    Failed to load resource: the server responded with a status of 404 (Not Found)
    i get this error message can you help me to fix it please I really need to finish connecting my form tonight

  • @mimitecrazy
    @mimitecrazy 3 года назад

    do you have to save the dependecies with --save -dev if you want to put in on a server ?

  • @GhostRanger-zj1lg
    @GhostRanger-zj1lg 3 года назад

    Are you able to show me how to do this but with a modal form created with semantic reactjs? it would really be helpfull

  • @therealdemonlord8061
    @therealdemonlord8061 3 года назад

    You mentioned storing this in environment variables, could you elaborate? I would prefer to have the password secure.

    • @adrianozuna4009
      @adrianozuna4009 3 года назад

      You store the password in the environment variables so that you don't have your password all over you code. Let's say you don't use environment variables to store passwords, and then you decide to push you code to github. In that case you wouldn't be able to hide that password since it's in your code itself, not as an environment variables.
      I know my explanation is really bad, but basically if you want to store it safely, use the environment variables.

  • @trax7214
    @trax7214 3 года назад

    Thanks man it works

  • @my.code.studio
    @my.code.studio 11 месяцев назад

    im tryin to add this contact form to my website and just haye 2 questions 1. how to hide the credentials of the email and pass and 2. can i run this together with my html css website. sorry im a beginner thanks for the help videos are good thank you for uploading

    • @syit_334_vaibhav3
      @syit_334_vaibhav3 3 месяца назад

      create a .env file in your project and paste your password and email there as a variables and use those variables on your contact form

  • @MamamimPlodtook
    @MamamimPlodtook 2 года назад

    I have done follow your video and everything is work fine. But when I deploy my site to Netlify is not working it show error "email cannot sent" I am new for coding and i want to know how to fix it.

  • @resurekt97
    @resurekt97 2 года назад

    So i want to send the full list of details to the email. Not just the message. How would i do it?

  • @inesborges4857
    @inesborges4857 3 года назад +1

    in my xhr.open(method, url) I don't think it is working because my folder structure is different. My app.js is inside a folder named js and my index.html is outside that folder in the main root. How do I fix this?

    • @ConorBailey
      @ConorBailey  3 года назад +1

      Hi Ines. What is the path for the post request in your server? This is the path you need to add to the xhr.open method.

    • @inesborges4857
      @inesborges4857 3 года назад +1

      @@ConorBailey What is the path for the post request in my server?

    • @ConorBailey
      @ConorBailey  3 года назад +1

      @@inesborges4857 it’s the app.post route I create at 25:04 in the video. Did you create a route like this?

    • @inesborges4857
      @inesborges4857 3 года назад

      @@ConorBailey Yes I did create a route like that. When Ii try to send an email it says to me that something went wrong. Btw I am using hotmail.

    • @inesborges4857
      @inesborges4857 3 года назад +1

      @@ConorBailey I have a ReferenceError: mailoptions is not defined but mailOptions is written correctly. I have changed it. It is still not working

  • @inception252
    @inception252 3 года назад +1

    pls tell me
    why putting password in source code?
    do i have to put my real email password in source code? what if i put different password in source code?

  • @itsern6983
    @itsern6983 3 года назад

    Thank you very much, it helped me a lot! Just a few question, how can I do to hide the password in my code and thus securise it? You talked about variable environment, did you make a tuto about it? And why did you choose the PORT 5000 and not another one for the localhost?
    Have a good day!

    • @ConorBailey
      @ConorBailey  3 года назад

      Hi mate. Thanks for your comment. Use the dotenv library to set up environment variables. You can use these to hide sensitive information in your code. There’s a tutorial here: ruclips.net/video/zwcvXd3kGbw/видео.html
      I just chose port 5000 randomly. Doesn’t really matter for development. Thanks again.

    • @itsern6983
      @itsern6983 3 года назад

      @@ConorBailey Thank you very much for your answer. And how can I do to put it on my FTP server when the hmtl file is in the "public" folder, I modified the htaccess file but it loads only the html file but not the CSS and JS (it works very well on my localhost server but not on my OVH) ?
      Thanks again to you!

  • @jsart_pl
    @jsart_pl 2 года назад

    Will this actually work on external server? Like when it's hosted on the Internet? Or does that work only on localhost?

    • @mrbobbilly2
      @mrbobbilly2 Год назад

      Only works with localhost, you need to do a bunch of configurations if you want to use this on a deployed app with custom urls, especially if you want to use it with gmail or Github

  • @evaprzybyla8955
    @evaprzybyla8955 2 года назад

    hey I am testing on my localhost, receiving 405 method not allowed error... how to solve this ? (it's POST method giving the error .... ) thx for help!

    • @ConorBailey
      @ConorBailey  2 года назад

      Hey Eva. Did you create the post route? See from 25:00 in the video. Thanks!

    • @evaprzybyla8955
      @evaprzybyla8955 2 года назад

      @@ConorBailey thank you for your reply! Turned out I had many other small issues in my code :) but it's working now thx!

  • @carlosduque8767
    @carlosduque8767 3 года назад

    Will this also accept emails from other services like yahoo, hotmail, etc. ?

  • @mohammadvahedi4965
    @mohammadvahedi4965 3 года назад

    Thank You !!!! :))

  • @Ireland1981
    @Ireland1981 3 года назад

    Thank you so much!!!!!!!!!

    • @ConorBailey
      @ConorBailey  3 года назад

      hey Sinead. Thanks for watching! Did you get this working in the end?

  • @miguelfernandes7728
    @miguelfernandes7728 3 года назад

    Hello!! Everything working but at 26:00, get the alert ('Something went wrong!') ?? can't get the app.post of req. body workin. any help??

    • @ConorBailey
      @ConorBailey  3 года назад +1

      Hey mate. Do you have your code on GitHub? I can take a look.

    • @miguelfernandes7728
      @miguelfernandes7728 3 года назад

      @@ConorBailey Thabk you for the attention. if u could take a look, the project is 'Lab' on my git - miguelfernandesidesign

    • @tulitikku7268
      @tulitikku7268 3 года назад +1

      I have the same issue? Any solutions?

  • @Noobfx23
    @Noobfx23 9 месяцев назад

    I have somthing went wrong and in cosole 404 error method not allowed

  • @OmarMoaZein95
    @OmarMoaZein95 Год назад

    hello sir
    thank you for vedio
    Are you have this tamplate by rar file ?

  • @onyedikachierugo4120
    @onyedikachierugo4120 3 года назад

    this is very helpful, Hi Conor been looking for your social media handles just wanted to connect if you don't mind.

    • @ConorBailey
      @ConorBailey  3 года назад

      Hey mate. Thanks for your comment. Im on LinkedIn :D www.linkedin.com/in/conor-bailey/

  • @Jlewray
    @Jlewray 3 года назад

    I keep on getting 'Somethning went wrong' and the form input is not logging on the console. Has anyone came across this problem?

    • @Karina-bv1rl
      @Karina-bv1rl 2 года назад

      yep! i've got it on deployment. currently working through it. did you figure it out?

  • @bhagyashreekolhe1895
    @bhagyashreekolhe1895 3 года назад +1

    Hi it showing 500 internal server error

  • @ranadebnath5421
    @ranadebnath5421 3 года назад

    I think using body-parser will be better approach

    • @ConorBailey
      @ConorBailey  3 года назад +1

      Cools thanks. Will look into body parser. What are the advantages?

    • @ranadebnath5421
      @ranadebnath5421 3 года назад

      @@ConorBailey sir,. Actually I was trying to send mail ..by watching you video .. and really it helps me lot .. but then I think that I can avoid the extra code which you write in front-end js file .. to do this I just use body-parser , name of the input, and nodemail

  • @makandriival8507
    @makandriival8507 2 года назад

    will this work in React App?