Node.js - SEND Emails Using Nodemailer | Gmail | OAuth2

แชร์
ฝัง
  • เผยแพร่เมื่อ 3 ม.ค. 2025

ความคิดเห็น • 123

  • @ozzyfromspace
    @ozzyfromspace 3 ปีที่แล้ว +4

    Nah, bro. JoeMama's not awesome. YOU'RE AWESOME!! This legit just saved me a whole night of insane trial and error 🏆✨. And now I've gotta sub, I don't have a choice, it's not up to me, the gods have spoken 😂🙌🏽. Keep it up bro.
    Oh, and your chill but not corny onscreen personality is 💙🔥

    • @MelvinAdekanye
      @MelvinAdekanye  3 ปีที่แล้ว

      Thanks Ozzy! Truly appreciate it.

  • @yuchenkuang
    @yuchenkuang 8 หลายเดือนก่อน

    Your tutorials are really great! I'm in the process of implementing a ContactMe module on my profile but I've been stuck with this problem all day!

  • @ShivShankar000
    @ShivShankar000 ปีที่แล้ว +1

    a small advice to friends. at 4.50 it was not working as shown in video. so i added a new redirect uri same uri but remove last / sign. And Thanks Sir. It helped

    • @MelvinAdekanye
      @MelvinAdekanye  ปีที่แล้ว

      Thanks for passing along the advice!

  • @pascal12355
    @pascal12355 2 ปีที่แล้ว +1

    5:06 Shouldn't you need to check the "Auto-refresh the token before it expires." option ?

  • @ElChanchoGanador
    @ElChanchoGanador 2 ปีที่แล้ว +1

    Error: No refresh token or refresh handler callback is set.ERROR
    any help?

  • @ItzJanix
    @ItzJanix 3 ปีที่แล้ว +6

    "let's Call Him Joe... Joe MAMA 🤣🤣"

  • @Marc1920x1080p
    @Marc1920x1080p 10 หลายเดือนก่อน

    Dear Melvin, thank you for this great video. May i ask you a question? This setup seems to work only for developing. Since i have published the app as you suggested, i get this epic "invalid grant" error from production backend, whereas in development everything works fine. Do you have any idea, what to do? I would appreciate it very much. Cheers, Marc

    • @cdexzswzaqME
      @cdexzswzaqME 7 หลายเดือนก่อน

      did you figure out how to solve this issue

    • @Marc1920x1080p
      @Marc1920x1080p 7 หลายเดือนก่อน

      @@cdexzswzaqME no. Finally i have switched to Mandrill (Mailchimp) Service, which is very reliable for production and works like a charm. Cost about 40$ per month

  • @Elrawaa
    @Elrawaa 3 ปีที่แล้ว +1

    Hi bro i enjoy watching your videos.
    I want to know if i can know : for example when some amazon product is posted ?

    • @MelvinAdekanye
      @MelvinAdekanye  3 ปีที่แล้ว

      That's awesome to hear. Thank you. Ooo. Are you wanting to make a program that sends emails when an amazon product is posted/updated?

  • @raba650
    @raba650 3 ปีที่แล้ว +1

    If the oath will be used for a contact form to send emails, wouldn’t a service account be more fit in this use case scenario?

    • @yashojha5033
      @yashojha5033 3 ปีที่แล้ว

      stuck in same stuff.

    • @raba650
      @raba650 3 ปีที่แล้ว

      @@yashojha5033 I just switched to emailjs. Nodemailer with Oauth2 didn’t work in production only development. Terrible.

  • @cdexzswzaqME
    @cdexzswzaqME 7 หลายเดือนก่อน

    Can we use this same process for production

    • @MelvinAdekanye
      @MelvinAdekanye  6 หลายเดือนก่อน

      Yep! I've used it as well in prod.

  • @puriajahanbani6636
    @puriajahanbani6636 2 ปีที่แล้ว +1

    That was awesome! The `Joe mama` part made me laugh loudly.

  • @victovicto8172
    @victovicto8172 ปีที่แล้ว

    dude you helped me a lot! thank you so much

  • @Faizalahmed-wb1yf
    @Faizalahmed-wb1yf 7 หลายเดือนก่อน

    Can I send also outlook and Gmail also?

    • @MelvinAdekanye
      @MelvinAdekanye  6 หลายเดือนก่อน

      You you can with Outlook. Would you like to see a tutorial with outlook?
      Here's the API page for outlook: learn.microsoft.com/en-us/graph/outlook-mail-concept-overview

  • @juressic3881
    @juressic3881 2 ปีที่แล้ว

    I've got 401 unauthorized, and then realized there was spaces in my CLIENT ID. THANKS, THIS TUT IS CRAZY

    • @MelvinAdekanye
      @MelvinAdekanye  2 ปีที่แล้ว

      That's great! Glad you figured it out.

  • @bossgamer9411
    @bossgamer9411 2 ปีที่แล้ว

    Hi RhymBil, super clear video. Just not sure why I'm getting 'Error: Can't create new access token for user'. I've tried changing my client id and secrets, new refresh tokens but nothing has worked. Any idea what might be wrong?

    • @MelvinAdekanye
      @MelvinAdekanye  2 ปีที่แล้ว

      I appreciate it. This thread might help: stackoverflow.com/questions/45665349/trying-to-use-nodemailer-to-send-emails-using-gmail-and-am-receiving-the-error

  • @dhanushsriramula2888
    @dhanushsriramula2888 5 หลายเดือนก่อน

    Bro, can we able to send email from user gmail using my website?

  • @NaveenKumar-os8dv
    @NaveenKumar-os8dv 2 ปีที่แล้ว

    How can I make others send the mail?? Like someone is already logged in to my site, and they want to send mail from there, how can it be done?

  • @aarondz789
    @aarondz789 2 ปีที่แล้ว

    Thanks!And, i got a error about option object: Error: Options "privateKey" and "user" are required for service account!

  • @codecombination9337
    @codecombination9337 3 ปีที่แล้ว

    HI,
    I have followed this tutorial step by step but in the end i get timeout error
    and also access token was not populating before sending email due to unhandled promise i replaced that with hard coded access token
    now I got timeout error how to resolve that

    • @MelvinAdekanye
      @MelvinAdekanye  3 ปีที่แล้ว

      Hmm. That's very weird. If you're still having that issue. Here's a forum that can help: stackoverflow.com/questions/42387451/nodemailer-connection-timeout-error

  • @clepzzz
    @clepzzz 2 ปีที่แล้ว

    Hi RhymBil, I did same steps and achieved to send emails on January 4. However I encountered with "invalid_grant, bad request" error. I achieved to send emails again after generate a new refresh token.
    Why did this happen? Do I need to generate a new refresh token after some time manually by clicking 'exchange authorization code for tokens' button and then replace new generated refresh token with old?

    • @MelvinAdekanye
      @MelvinAdekanye  2 ปีที่แล้ว +2

      Hmm. This is a good question. I also encountered the same issue. But once I got a new token (similar to your situation). I didn't seem to have the issue again. As far as I've experienced, it's only happened once, but definitely a question I'm going to have to look into. Thanks for the great question.

    • @NITHINPB
      @NITHINPB ปีที่แล้ว +1

      @@MelvinAdekanye Hey, did you get time to look into this ? i am implementing this and it works fine now. But i am exprecting this error soon, since refresh_token has an expiry

  • @shannudeepufans
    @shannudeepufans 3 ปีที่แล้ว

    How to fetch data if we use push() method?? Firebase web
    Source code please

  • @juressic3881
    @juressic3881 2 ปีที่แล้ว

    Part of the function 'transport.sendMail' won't call when the function is inside a middleware.. Please help!

    • @MelvinAdekanye
      @MelvinAdekanye  2 ปีที่แล้ว

      For sure. Email me with your question.

  • @hoangduytran3266
    @hoangduytran3266 2 ปีที่แล้ว

    Authorization Error
    Error 400: invalid_scope
    Some requested scopes were invalid. Do you help me?

  • @kuku687
    @kuku687 2 ปีที่แล้ว

    why my code getting error
    throw new Error('No
    refresh token or refresh handler callback is set.');
    ^
    Error: No refresh token or refresh handler callback is set.

    • @MelvinAdekanye
      @MelvinAdekanye  2 ปีที่แล้ว +1

      It seems like your refresh token wasn't set up properly.... email me. I'll try to help.

  • @luisdev7646
    @luisdev7646 3 ปีที่แล้ว

    Help, i have done all the steps, working fine, but after a week i get the error (invalid grant 400 bad request), and i have to generate manually the refresh_token

    • @MelvinAdekanye
      @MelvinAdekanye  3 ปีที่แล้ว

      Did you publish/make public your Google API? If you leave it in test mode, you'll have to update the tokens every now and then.

  • @gbdasfrases
    @gbdasfrases 2 ปีที่แล้ว

    when the refresh token expires the emails are no longer sent! Any solution?

    • @MelvinAdekanye
      @MelvinAdekanye  2 ปีที่แล้ว

      Yes! To fix this, I normally redo the process to get a new token.

  • @naeemshaikh4683
    @naeemshaikh4683 ปีที่แล้ว

    i am getting this error {
    "err": {
    "code": "EAUTH",
    "command": "AUTH XOAUTH2"
    }
    }

  • @swdotdev
    @swdotdev 2 ปีที่แล้ว

    First of all thank you very much dude! You are awesome. It works almost perfectly for me. Somehow it sends two emails. One with the expected message and subject etc, and another one with nothing in it? Anyone else is having this issue?

    • @MelvinAdekanye
      @MelvinAdekanye  2 ปีที่แล้ว

      You're most welcome! That's interesting. Do you have your code in a loop? Or duplicated?
      If no, add console.log() where you have your send function, to see if it logs twice.

  • @ebenezersiaw935
    @ebenezersiaw935 2 ปีที่แล้ว

    Bro I keep getting this, error: 'invalid_client',
    error_description: 'The OAuth client was not found.'

    • @MelvinAdekanye
      @MelvinAdekanye  2 ปีที่แล้ว

      You might find this thread useful. stackoverflow.com/questions/43334280/google-oauth-invalid-client-the-oauth-client-was-not-found

  • @nico2669100
    @nico2669100 ปีที่แล้ว

    Helped Me alot, thx

  • @aaronstoler6216
    @aaronstoler6216 3 ปีที่แล้ว

    This is really helpful, but I'm getting a ETIMEDOUT error. I've tried everything...enabled less secure apps and disabled two factor authentication. Any ideas on how to resolve?

    • @MelvinAdekanye
      @MelvinAdekanye  3 ปีที่แล้ว +1

      Hmm. Sounds interesting. I haven't encountered an ETIMEDOUT error. But email me screenshots of the error. Lets work it out.

    • @aaronstoler6216
      @aaronstoler6216 3 ปีที่แล้ว

      @@MelvinAdekanye just sent

    • @VatsalSharma07082000
      @VatsalSharma07082000 2 ปีที่แล้ว

      @@aaronstoler6216 Were you able so fix that? I am getting the same error.

    • @aaronstoler6216
      @aaronstoler6216 2 ปีที่แล้ว

      @@VatsalSharma07082000 my server specifically blocked the ports necessary to send emails. They do it as a precaution against spamming. I emailed a request to the server to unblock the ports and the problem was immediately fixed

  • @akrazzy9236
    @akrazzy9236 2 ปีที่แล้ว +1

    You were so funny back in 2019 xd

    • @MelvinAdekanye
      @MelvinAdekanye  2 ปีที่แล้ว

      Were?!? Hahaha. Thanks I appreciate it.

  • @chongchuongwun
    @chongchuongwun 3 ปีที่แล้ว

    Hi, Is this features free of charge?

    • @MelvinAdekanye
      @MelvinAdekanye  3 ปีที่แล้ว

      Yes. Google offers this feature completely free.

    • @chongchuongwun
      @chongchuongwun 3 ปีที่แล้ว

      @@MelvinAdekanye Thank you for reply ^_^

    • @MelvinAdekanye
      @MelvinAdekanye  3 ปีที่แล้ว

      @@chongchuongwun You're most welcome!

  • @brainedbeats9003
    @brainedbeats9003 2 ปีที่แล้ว

    yo bro could it be easy of you to make a realtime online visitors in firebase tutorial? I love ur vids btw!!

    • @MelvinAdekanye
      @MelvinAdekanye  2 ปีที่แล้ว

      Wow. Thanks. Have you tried this tutorial: th-cam.com/video/tZcNBB6spcs/w-d-xo.html

  • @lonewolfcoding5208
    @lonewolfcoding5208 2 ปีที่แล้ว

    pls help it is shutdown or rejected

    • @MelvinAdekanye
      @MelvinAdekanye  2 ปีที่แล้ว

      For sure! What errors are you getting?

  • @KathouQC
    @KathouQC 2 ปีที่แล้ว

    Hi, How I can fix the issue of invalid_grant_token after 7 days? Because now I need to change the refresh token each 7 day ... thank :)

    • @MelvinAdekanye
      @MelvinAdekanye  2 ปีที่แล้ว

      Just to double check have you been able to publish your google project? (Changed from test to published)?

    • @KathouQC
      @KathouQC 2 ปีที่แล้ว

      @@MelvinAdekanye yes, I am in the testing of this solutions:
      Create a new user after switching on production mode.
      So I will wait and see if I will neeed to rechange, if the information I get is right the anwser is no, it's should work :)

    • @MelvinAdekanye
      @MelvinAdekanye  2 ปีที่แล้ว

      Yes! While the testing mode is great. It's simply just that, a means to test (with time limitations).
      Switching to "production mode" will take away those testing time constraints. And you're right. It should work.

  • @iacrabat7367
    @iacrabat7367 3 ปีที่แล้ว

    You are a savior thank you man

  • @muizuddeenahmad6142
    @muizuddeenahmad6142 3 ปีที่แล้ว

    I'm not getting email on my gmail, all things are working properly

    • @MelvinAdekanye
      @MelvinAdekanye  3 ปีที่แล้ว

      Wow! So your console is completely error free but yet it doesn't work?
      If that's the case, maybe try redoing the step of getting your tokens.

    • @muizuddeenahmad6142
      @muizuddeenahmad6142 3 ปีที่แล้ว

      @@MelvinAdekanye yes sir,, i have done again all steps of tokens.

    • @muizuddeenahmad6142
      @muizuddeenahmad6142 3 ปีที่แล้ว

      Please tell me

  • @carlalexisalcantara5298
    @carlalexisalcantara5298 3 ปีที่แล้ว

    hi man can you make an html doc that gives numbers staring to 1 to 999,999,999

  • @abuumar8794
    @abuumar8794 ปีที่แล้ว

    its worked for me. ❤

  • @neveriodev350
    @neveriodev350 ปีที่แล้ว

    Thank you so much

  • @newrequest3228
    @newrequest3228 2 ปีที่แล้ว

    error: 'unauthorized_client', error_description: 'Unauthorized' WHATS WRONG?

    • @MelvinAdekanye
      @MelvinAdekanye  2 ปีที่แล้ว

      Did you find a solution? if not, I'd definitely be down to help. Reach out to me via email

  • @militoarturo
    @militoarturo 2 ปีที่แล้ว

    Omg, thank you thank you bro

  • @mrfirebaby5925
    @mrfirebaby5925 3 ปีที่แล้ว

    Super

  • @iasontzortzis9472
    @iasontzortzis9472 3 ปีที่แล้ว

    you a legend

  • @khatamati5282
    @khatamati5282 2 ปีที่แล้ว

    it's a great tutorial. 1M thanks

  • @airxperimentboom
    @airxperimentboom 3 ปีที่แล้ว

    this is awesome content

  • @waytofuture
    @waytofuture 2 ปีที่แล้ว

    It's working sir thank you so much sir

  • @iacrabat7367
    @iacrabat7367 3 ปีที่แล้ว

    + 1 subscriber man thank you

  • @AlexanderDemin
    @AlexanderDemin ปีที่แล้ว

    Man, what a great video! Thanks.

  • @yashojha5033
    @yashojha5033 3 ปีที่แล้ว

    Yooo sickkk

  • @MichelLedig
    @MichelLedig 2 ปีที่แล้ว

    Bro.dont ever do cuts with zoom in or out in a page with so much to see.again.
    The path of where your mouse is going is very important to the dumbasses like me.
    Aside this, great video thx for the help

    • @MelvinAdekanye
      @MelvinAdekanye  2 ปีที่แล้ว

      Thanks for the feedback. You're very welcome.

  • @moisesmauroochoaparedescan838
    @moisesmauroochoaparedescan838 2 ปีที่แล้ว

    GRACIAS BROOOOOOO ENSERIO GRACIAS

  • @bradical8198
    @bradical8198 2 ปีที่แล้ว

    Fail

  • @mr._.bhat007
    @mr._.bhat007 ปีที่แล้ว

    please check how to automatically get new refreshToken once it expires. Bro if i could jump to your place and kiss you on your cheeks i would bro... Also Thanks

    • @MelvinAdekanye
      @MelvinAdekanye  ปีที่แล้ว

      Ay yo 🤣🤣 This made me laugh! Thanks Pranav!

  • @weixian7197
    @weixian7197 2 ปีที่แล้ว

    b0ss very cool.

  • @sohaibarbii
    @sohaibarbii 3 ปีที่แล้ว

    you save my Ass thanks

  • @dananjayachathuranga7113
    @dananjayachathuranga7113 ปีที่แล้ว

    nice video. but thumbnail look like indian