Brad, you have helped me immensely. I was finding outdated posts on how to use Nodemailer. I finally came across your video and got my form to work. You are awesome and deserve way more than 183K subscribers. I hope you get to one million. Keep up the good work, and you've gained a subscriber :)
Guys, don't skip the ads that play on this channel. It will help the channel. I used to skip the ads in the beginning as I wasn't aware of it. Thanks Brad for these awesome videos. Cheers! 🍻
In order for the UA-camr to get compensated for the ad, you must either sit through 30 seconds of the ad or through the completion of the ad - whichever one comes first.
Not sure this is actually true. Otherwise the UA-camr is being held accountable for how good the ad actually is, which isn't the case. Would like a reference for this otherwise, since I've heard that it doesn't matter to the channel owner (they just decide how many commericals/where they're placed)
Just about the only tutorial I've seen where I was able to roll through a test email on the first try. Kudos my friend. *Please make sure to use environment variables when going live. Search for environment variables for NodeJS and you should have no problem you don't wanna expose your credentials to the world!
You made it so easy for me to understand how nodemailer works! Thanks to you, I've successfully implemented nodemailer into my portfolio project (verifying an email address for an express app). You rock, Brad! Seriously, you do!
@@ozzyfromspace thanks for responding quickly! So, im implementing this back end code into my website and i dont understend if i have to put all my html into the contact.handlebar or only the html of the form.
The approach I would generally recommend is to have an html form so you can post inputs to an app.js type server. Then copy-paste the node-mailer code and replace their test account with your own, and pass an html object (scoped to a div) to the html field. Hopefully this helps. It’s hard to say more without seeing relevant parts of your code. I’m online watching a lecture so I’ll see your response if you’re quick enough (within the next 40 minutes or so). Best wishes
For anyone having an error similar to "Error: ENOENT: no such file or directory, open '/mnt/c/users/name/Email/views/layouts/main.handlebars'", Use res.render('contact', {layout: false}); instead of res.render('contact');
Finally I found someone with real knowledge. I was looking for this video all over the internet but people were always using some crap like mailgun with nodemailer. Thanks man, this video really helped me a lot :)
mate I have been searching for such a tutorial for a long time, Thanks. One of the best if not the best javascript tutorials channel highly recommended to subscribe
Just started my journey in to backend and wanting to put a contact form on my portfolio. This is awesome, thank you for this. I realize this is about 5 years old at this point but I’m subscribing and looking forward to you new stuff.
one tip for actually planning on using this live: you can setup system environment variables through your web deploymsnt service (example Heroku) that way you can use those in place of actual usernames passwords for better security.
On a lighter note, I think the dislikes you get might be from old grudges, probably your exes. How on earth would your videos have dislikes, not even from competitors! Thumbs up Brad!
Thanks Brad you a re a lifesaver. I've learned so much from you and can't thank you enough for all the free work you do for us. Your new web site is top class. Would like to see how you created that shrinking menu, those animations and milestones. If you don't have anything else going on right now, :)
Thanks. Glad you mentioned you didn't use SSL. My website mentions different parameters for no SSL. I have one website on one host with email and another on heroku with no email. I got it so the code in heroku will use the system on my other website to send emails as needed. Cool!
I dont understand 1 thing, where he put all from the HTML file to the handlebars. When I have my full website, do I have to put all the html to the handlebars or just the class containing the form ?
I must have went through 15 tutorials and finally I got it to work with your video! Thank you. I had to actually put the form inside of view/layouts/main.handlebars and it worked. How do I actually get it to work on a shared hosting server? I to am using inmotion hosting.
Hey, you example is working great on local, but the same is not working on live server, I have removed the tls: parameter , the error is " timeout ", please can you help me to get this done
Hi Alfred, I'm having I'm trying to implement react with nodemailer but I'm having issues doing that, can you help me out? I will be looking forward to your response.
@@joshuaolajide1479 for the backend i tested stuff with the following route: app.post("/send", (req, res) => { console.log(req.body) } In the front end, I have an action like this: const sendEmail = async (formData) => { const config = { // don't recall if this is necessary, didn't test yet headers: { "Content-Type": "application/json" } }; try { const res = await axios.post("localhost:5000/send", formData, config); // check what you have returned console.log(res.data); // ... } catch (err) { console.log(err); // ... } }; And in the app I call the sendEmail(formData) providing the name, email and message as formData
For anyone having an error similar to "Error: ENOENT: no such file or directory, open '/mnt/c/users/name/Email/views/layouts/main.handlebars'", Use res.render('contact', {layout: false}); instead of res.render('contact'); use this instead for all such type of errors app.engine('handlebars',exphbs({ defaultLayout:false, }));
Hey could you in depth explain how you managed to fixed it? Errors below when I send from the form Message sent: Preview URL: false Error: ENOENT: no such file or directory, open 'C:\Users\Brad\Desktop\Brad_Traversy\Node_imail\views\layouts\main.handlebars'
@@SharePinPoint hi there, so did you put your html into both public folder and views folder? also, did you put all your html or only the form html? thanks a lot!
@@ludaxofficial check the last line of the code. Its almost an year now But I think as the last line suggests in views folder. Entire html file including the code
Hey Travy there are lot of us who made react.js front-end web sites and left whit blank contact form part. Can you make a next part on how to connect this great technique with the existing react site and how to set it up - depoloy on the server ? Or just how to separete your existing files (index, css ) and connect them to work on same root - folder ? Please man ...please :) i will do favor for you...
This is pretty cool and it works. However, the test email and password are essential exposed on the server. Is there a more secure way of handling this?
after this video it submits but doesnt send the email. but when I comment out the firebase script then it sends the email but shows the "layouts/main.handlebars'" error and obviously doesn't send to the firebase. how do I get both to work?
Thx for this. Also would be great to see something game-like with nodejs+socketio. Simple gameapp, like scissors-paper-rock or something (there is one actually on youtube), but with your style of explaining stuff.
Thank you, Brad! Considering the frequency by which Node, NPM etc are updated, could you please indicate which versions you are using? Thank you so much!
Can't send emails through a proxy :/ In Windows 10 i have set the environment variables for the proxy and i can download npm packages, but nodemailer throws a 403 error (Forbidden). If i leave the 'proxy' option out while creating the transport, it just times out after ~20 secs.
Video starts at 22:00 for those who are familiar with the basics of Node and Express.
i wanna upvote you so bad, but it says 69, so take this as an upvote :)
thanks
thanks time saver
Brad, you have helped me immensely. I was finding outdated posts on how to use Nodemailer. I finally came across your video and got my form to work. You are awesome and deserve way more than 183K subscribers. I hope you get to one million. Keep up the good work, and you've gained a subscriber :)
Thank you very much :) hopefully someday
@@TraversyMedia lol, You already did it :)
Guys, don't skip the ads that play on this channel. It will help the channel. I used to skip the ads in the beginning as I wasn't aware of it. Thanks Brad for these awesome videos. Cheers! 🍻
In order for the UA-camr to get compensated for the ad, you must either sit through 30 seconds of the ad or through the completion of the ad - whichever one comes first.
Not sure this is actually true. Otherwise the UA-camr is being held accountable for how good the ad actually is, which isn't the case. Would like a reference for this otherwise, since I've heard that it doesn't matter to the channel owner (they just decide how many commericals/where they're placed)
Ads? What are those? I never see them thanks to AdBlock. I dont think that google would let you skip ads by default anyways...
If he splits the compensation 50/50 with me :)
@@bradical8198 He's splitting the compensation with you by taking the time to make these videos and share his knowledge with you for free!
Just about the only tutorial I've seen where I was able to roll through a test email on the first try. Kudos my friend.
*Please make sure to use environment variables when going live. Search for environment variables for NodeJS and you should have no problem you don't wanna expose your credentials to the world!
DUDE i was searching for 3 days and then I saw you and I remember how cool your videos are!! Thank you!
Bloody Hell you really are the best!
Exactly!! Same here
You made it so easy for me to understand how nodemailer works! Thanks to you, I've successfully implemented nodemailer into my portfolio project (verifying an email address for an express app). You rock, Brad! Seriously, you do!
im having an issue integrating this into my existing portfolio, could you pleasae help me out?
@@ludaxofficial hi, I can try. What’s not adding up?
@@ozzyfromspace thanks for responding quickly! So, im implementing this back end code into my website and i dont understend if i have to put all my html into the contact.handlebar or only the html of the form.
@@ludaxofficial hi, do you wanna meet on jitsi. It’s an opensource video platform where people can chat in real-time without creating an account?
The approach I would generally recommend is to have an html form so you can post inputs to an app.js type server. Then copy-paste the node-mailer code and replace their test account with your own, and pass an html object (scoped to a div) to the html field. Hopefully this helps. It’s hard to say more without seeing relevant parts of your code.
I’m online watching a lecture so I’ll see your response if you’re quick enough (within the next 40 minutes or so). Best wishes
Every time I look for a web design tutorial, you're the best one that comes up. Thanks so much!
hey bro this is not web designing this is backend development.
@@meteachesprogramming9395 Design or Dev does it really matter if your learning?
For anyone having an error similar to "Error: ENOENT: no such file or directory, open '/mnt/c/users/name/Email/views/layouts/main.handlebars'", Use res.render('contact', {layout: false}); instead of res.render('contact');
Yes , I have same problem.
still not working
app.locals.layout = false; adding this helped me
Thanks @Mike Pauls
Some heroes doesn't wear cape.
Finally I found someone with real knowledge. I was looking for this video all over the internet but people were always using some crap like mailgun with nodemailer. Thanks man, this video really helped me a lot :)
Dude! I've been beating me head against a wall for 4 days. This example totally helped me figure out what the issue was. Thanks so much.
This makes me feel a bit better XD
mate I have been searching for such a tutorial for a long time, Thanks. One of the best if not the best javascript tutorials channel highly recommended to subscribe
Just started my journey in to backend and wanting to put a contact form on my portfolio. This is awesome, thank you for this. I realize this is about 5 years old at this point but I’m subscribing and looking forward to you new stuff.
Beautiful. I had to go figure nodemailer out for my Heroku app. And then this vid comes out. I wish I had it two weeks ago!
Nice work Brad.
one tip for actually planning on using this live: you can setup system environment variables through your web deploymsnt service (example Heroku) that way you can use those in place of actual usernames passwords for better security.
Thanks
Np! btw I love your videos. You practically taught me MEAN JS. Great work!
are you able to get this to work in production? im getting 503 response code, even though it works locally
Mine too doesn't work. I hope someone has been able to solve this.
how?
On a lighter note, I think the dislikes you get might be from old grudges, probably your exes. How on earth would your videos have dislikes, not even from competitors! Thumbs up Brad!
Mr Kayode can I propose a business ? my email is it.dept@cresentdecal.co.write me and I will explain further . Thanks Window controlAbouti
Thanks Brad you a re a lifesaver. I've learned so much from you and can't thank you enough for all the free work you do for us. Your new web site is top class. Would like to see how you created that shrinking menu, those animations and milestones. If you don't have anything else going on right now, :)
Damn! I so wanted this since so many days! Traversy came to rescue again. Thanks man!
Best educational content related to web development on UA-cam. By far.
I don't know how, but you always find the most interesting topics for your videos !!
I wish my Udemy course oulined a lecture like this, everyone in the course expected to see something like this! Great video!
I started studying after watching a lecture on Udemy. You are always helpful. thank you.
Awesome video, would like to see one on payment system.
Dor Solomon Stripe is Best and it is very easy to integrate.
Yep, i have working code if you want to see it.
SogMosee yes that would be great.
Thanks. Glad you mentioned you didn't use SSL. My website mentions different parameters for no SSL. I have one website on one host with email and another on heroku with no email. I got it so the code in heroku will use the system on my other website to send emails as needed. Cool!
man you are awesome!
i looked all forums in my country, but not found needed info
thanks a lot!
Your videos are very good. Short, crisp and very informational. I have become your subscriber. Thank you.
your videos like this,image upload, authentication,session help me in build my major project.....thank you sir...
I feel the same @subhadip dutta
you got 6 monitors? Brad you're a legend..
Father of Many developers Because of his content
Yesterday I implemented Nodemailer in my sandbox node + angular app for learning, what a surprise to see now that your video is about nodemailer. XD
Best programming tutor online, thank you very much for this video, it's really helpful
Another one of them best and helpful tutorials on youtube.. Thanks Brad Traversy!!!
Congratulations to reach 1 Million :D You deserve
This is 5 years old but still good, thanks
Love the vids!
One tip is nodemon doesn't require the file extension "node app"
Thank you! The tls: false trick is what I came here for. Much appreciated.
Awesome video mate! best nodemailer video on the web
Your video is amazing. It helped me a lot. It is for sure the best video I've watched on this subject. Thank you for helping others :)
Your video better than Game Of Thrones! Thanks!
can I propose a business ? my email is it.dept@cresentdecal.co.write me and I will explain further . Thanks Window controlAbouti
Great video man, you've helped me a lot with this topic. Hope you make more videos on node ect.
Thank you so much, Brad! This video helped me configure Nodemailer for our production application.
Mr Joshua, can I propose a business ? my email is it.dept@cresentdecal.co.write me and I will explain further . Thanks Window controlAbouti
I dont understand 1 thing, where he put all from the HTML file to the handlebars. When I have my full website, do I have to put all the html to the handlebars or just the class containing the form ?
same here, if you find a solution please let me know, im crushing my head into the wall
You are the man! I really enjoy your content! and you always put out relevant topics keep it up!
Thank you for all the tutorials, Brad. Keep 'em comin'.
Hey Brad! You are a life saver.This tutorial really helped me out.
Looking forward for the series on hosting!
how to send email for the person who filled the form ??
Thanks a lot ! it worked with one or two changes.But your code helped me!
I must have went through 15 tutorials and finally I got it to work with your video! Thank you. I had to actually put the form inside of view/layouts/main.handlebars and it worked. How do I actually get it to work on a shared hosting server? I to am using inmotion hosting.
i was stuck using smtpTransport and stuff but your video made it so simple.. thank you very much !! ^_^ ^_^ ^_^
Exactly what I was looking for. Thank you Brad!
Hey, you example is working great on local, but the same is not working on live server, I have removed the tls: parameter , the error is " timeout ", please can you help me to get this done
Thanks a lot Brad! I used nodemailer with react as my front end which I learned from your React course on Udemy :)
Hi Alfred, I'm having I'm trying to implement react with nodemailer but I'm having issues doing that, can you help me out? I will be looking forward to your response.
@@joshuaolajide1479 sure Joshua, what issues do you have?
Thanks for the quick response..... I don't know how to connect my front end (react) with nodemailer.
I've been able to get the values in the input but my problem is routing it to the backend
@@joshuaolajide1479 for the backend i tested stuff with the following route:
app.post("/send", (req, res) => {
console.log(req.body)
}
In the front end, I have an action like this:
const sendEmail = async (formData) => {
const config = { // don't recall if this is necessary, didn't test yet
headers: { "Content-Type": "application/json" }
};
try {
const res = await axios.post("localhost:5000/send", formData, config);
// check what you have returned
console.log(res.data);
// ...
} catch (err) {
console.log(err);
// ...
}
};
And in the app I call the sendEmail(formData) providing the name, email and message as formData
For anyone having an error similar to "Error: ENOENT: no such file or directory, open '/mnt/c/users/name/Email/views/layouts/main.handlebars'", Use res.render('contact', {layout: false}); instead of res.render('contact');
use this instead for all such type of errors
app.engine('handlebars',exphbs({
defaultLayout:false,
}));
@K M Getting this error: Error: Invalid login: 535 Incorrect authentication data
at SMTPConnection._formatError (D:\NodeJS
odecontactform-master
ode_modules
odemailer\lib\smtp-connection\index.js:605:19)
at SMTPConnection._actionAUTHComplete (D:\NodeJS
odecontactform-master
ode_modules
odemailer\lib\smtp-connection\index.js:1340:34)
at SMTPConnection. (D:\NodeJS
odecontactform-master
ode_modules
odemailer\lib\smtp-connection\index.js:378:26)
at SMTPConnection._processResponse (D:\NodeJS
odecontactform-master
ode_modules
odemailer\lib\smtp-connection\index.js:764:20)
at SMTPConnection._onData (D:\NodeJS
odecontactform-master
ode_modules
odemailer\lib\smtp-connection\index.js:570:14)
at TLSSocket. (D:\NodeJS
odecontactform-master
ode_modules
odemailer\lib\smtp-connection\index.js:710:55)
at TLSSocket.emit (events.js:310:20)
at addChunk (_stream_readable.js:286:12)
at readableAddChunk (_stream_readable.js:268:9)
at TLSSocket.Readable.push (_stream_readable.js:209:10) {
code: 'EAUTH',
response: '535 Incorrect authentication data',
responseCode: 535,
command: 'AUTH PLAIN'
}
Thanks!
@Kumar Anindo, thanks mate!
God it is really good to see that my comment is helping people
I love you, my dude!
I would recommend using yarn package manager as it's much quicker and I find it cleaner to use.
Love the content, really well taught !
Thanks man! I couldnt get the handlebars thing going.......Managed to push it by directly sending over the html.....Overall very precise and good!
Hey could you in depth explain how you managed to fixed it?
Errors below when I send from the form
Message sent:
Preview URL: false
Error: ENOENT: no such file or directory, open 'C:\Users\Brad\Desktop\Brad_Traversy\Node_imail\views\layouts\main.handlebars'
@@oscheka
//Static Folder
app.use('/public',express.static(path.join(__dirname,'public') ));
app.use(cors());
app.get("/",function(req,response){
response.sendFile(path.join(__dirname+'/public/index.html'));
//response.sendFile("/views/index.html");
});
@@SharePinPoint hi there, so did you put your html into both public folder and views folder? also, did you put all your html or only the form html? thanks a lot!
@@ludaxofficial check the last line of the code. Its almost an year now
But I think as the last line suggests in views folder. Entire html file including the code
Thanks for sharing. I learned something new from this video
This was very helpful even if I had to watch this in the future.
Critical point at 22:00 for those who know how to setup forms and express.
You should do a tutorial on how to use PayPal on your website to accept payments
yeah! i would like to see one too
Stripe
inbox to all hahaha
Exactly what I'm looking for. Thank you Brad!
How would I make the "contact.handlebars" file load as if it were a index.html?
Thanks dude! its amazing , quick and simple explanation !
Love you Brad! The man of web.
Excelent Video it help me so much to understand nodemailer, Thanks.
Any resources on how one would integrate this into an existing static site?
Thanks Brad for these awesome videos. Cheers!
This was mad helpful. Thank you 1000x.
Super video, thank you Brad, it works perfectly, even with firebase
Can we use EJS in place of handlebars?
yes but "{{msg}}" won't work and you have to put this code in your app.js: "app.set("view engine", "ejs");"
Thanks man! Really awesome video, it really helped me out, very grateful :)
Hey Travy there are lot of us who made react.js front-end web sites and left whit blank contact form part. Can you make a next part on how to connect this great technique with the existing react site and how to set it up - depoloy on the server ?
Or just how to separete your existing files (index, css ) and connect them to work on same root - folder ? Please man ...please :) i will do favor for you...
Thank you man, really helpful tutorial! I managed to make it work with Gmail.
would you help me please
Maybe I can help, what's going on ?
@@potential_spam69 what to place in s mtp
Thank a lot, this video was very helpfully to me!!!
Well done, great video and presentation. THX Paul
Had the same nodemon issue. Just use sudo to get by if you are working on your local machine
This is pretty cool and it works. However, the test email and password are essential exposed on the server. Is there a more secure way of handling this?
In lieu of installing the body-parser, you could also use the express parser. It's one line of code:
app.use(express.urlencoded( {extended: true} ));
Almost FIVE YEARS LATER AND STILL RELEVANT
Thank you! I've learnt a lot of interesting things on your channel!
consider becoming a patreon
Brad! Awesome... All the videos. Thanks
Thank You . it is really usefull and easy tutorial,
Loving your Bootstrap 4 course s far. I would love to see you do something on Progressive web apps
It's help me a lot! Thank you for sharing
after this video it submits but doesnt send the email. but when I comment out the firebase script then it sends the email but shows the "layouts/main.handlebars'" error and obviously doesn't send to the firebase. how do I get both to work?
awesome piece of content, def saved me alot of time. Thanks brah!
Just found your channel. It's great!
Excellent tutorial as always. It was that tls thing that had me stumped. Do we need to remove that for production?
If you have trouble installing nodemon globally, try: npx nodemon server.js
This install the package at run-time and will behave as a global package.
Thx for this.
Also would be great to see something game-like with nodejs+socketio. Simple gameapp, like scissors-paper-rock or something (there is one actually on youtube), but with your style of explaining stuff.
Hi is there a way to pass the authentication automatically and to fletch automatic the senders email ?
thank you sir! your tutorial helped me a lot!
You all know we tried to send an email with his credentials lol. JK. Brad your stuff is awesome. Thanks.
THANK YOU!!! I HAVENT WATCHED IT YET BUT, I ALREADY LOVE IT!
Thank you, Brad! Considering the frequency by which Node, NPM etc are updated, could you please indicate which versions you are using? Thank you so much!
Wow! Great as always!
You rock man!! Very helpful stuff!
@14:25 How did it look into the view folder for contact.handlebars you did not tell anywhere in the code to look into views folder
dont forget that you had to set your view engine to handlebars
No It is working, but i was wondering does it take the views folder in the root by default?
I know EJS templating language takes views folder by default, handlebars probably does too. Views folder for views and public folder for css.
Can't send emails through a proxy :/ In Windows 10 i have set the environment variables for the proxy and i can download npm packages, but nodemailer throws a 403 error (Forbidden). If i leave the 'proxy' option out while creating the transport, it just times out after ~20 secs.
trying to use this with angular do i still need to use the handlebars module, being that a template would already be setup in angular.
This is awesome! Great job!