Send email using java code tutorial

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

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

  • @CodeTechGyan
    @CodeTechGyan  2 года назад +2

    Code available at this page -
    wp.me/pdJoZn-4u

  • @jamesdawson4783
    @jamesdawson4783 2 года назад +2

    Had to change the smtp port from 547 to 587 to work. Other than that everything is good, thank you.

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

    best video on this topic but I really want to suggest to explain slowly as you are very fast

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

      Thank you .. I will keep that in mind while explaining next topic 😊

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

    This code has saved my life with a course project a day before the review 😭😭😭 Thank you soooo mucchhhh!!!! You're an amazing human being!!!

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

      Please subscribe to my channel and share with your friends

  • @atuldarne3239
    @atuldarne3239 4 месяца назад

    i want to restrict the email for print, fwd, reply how can be this done ? is there any specific header that we need to set

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

    I have the following error:
    Error occurred during initialization of boot layer

    java.lang.module.ResolutionException: Modules activation and java.activation export package javax.activation to module org.jetbrains.annotations
    Even though I have the following dependencies:
    com.sun.activation
    javax.activation
    1.2.0

    javax.activation
    javax.activation-api
    1.2.0

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

    Thank you so very much !!! My brain would be explode XD

  • @DeepakMaurya-bb3wf
    @DeepakMaurya-bb3wf 4 года назад +2

    hey i like your video. this code run can run local machine very well but if your server ip is different then you stuck even you can make security low still it wont work. can you come up solution of that. also please when u doing please check another case after 10 min are you still able to send mail. thanks..

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

      Thanks for liking the video . I am able to send emails at anytime using this code..never found any issues with that . Also, if you make changes in gmail security and allow it to get accessed by low security apps and remove 2-way authentication.. it should work

    • @DeepakMaurya-bb3wf
      @DeepakMaurya-bb3wf 4 года назад

      @@CodeTechGyan ok can you please make another video to host this app in vps/server(linux) and send mail back to you. and during that please show IP address of yours and server IP. Hope it will clear doubts.

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

      Sure , I will check on that

  • @kristjantoplana2993
    @kristjantoplana2993 11 месяцев назад +1

    Very good and helpful, but the email body is sent as an attachment. Anyone know how to resolve this?

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

      You can change the body part with this code :
      MimeBodyPart bodyPart = new MimeBodyPart();
      bodyPart.setText(emailBody, "UTF-8","plain");
      I hope this works for you 😉

  • @040aniruddhagunjal6
    @040aniruddhagunjal6 Год назад +1

    Its Showing .. : Could not connect to smtp host : email host value , port number

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

      Pls try with different port number and make sure you have entered correct host name .

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

    Please subscribe our channel ☺️

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

    thanks a lot...
    long live sister..lol

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

    I have a work similar to your video can you help me take a look at it?

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

    I figured out that throwing the exceptions is one of the problems I'm having and it says it can't initialize the main class. Do you have any suggestions?

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

      use it in the main method and use try and catch

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

    Can you post the whole code on like git

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

      Sure .. I will do that and share the link 👍🏻

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

      here is the code repository
      github.com/GitAccSK/code-tech-gyan/blob/main/Send%20email%20using%20java

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

    Great video! But I get the issue that it sends a document ""noname" and no body text when running your exact code. How can I fix this?

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

      Looks like email subject and body is not being added properly to the multipart object.can you compare your code to the git code I provided. Check video description for git link.

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

    I have one doubt here and in general too,
    How you create an instance of an object without using the keyword “new” for example Transport object here? Without the “new” keyword, Java cannot make a new instance of the object in heap memory, right!

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

      You can get an object from connection factory. In this example newSession is a connection factory and getTransport() is used to fetch a transport object from that.

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

    My InternetAddress showing error please help me to and give me a solution please. 😕😕😕😕😕

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

    thank you so much..

  • @Alexander-dj1jp
    @Alexander-dj1jp 3 года назад

    Hello, my body in the email is displayed as: "noname" and there's not the text which I have put in the emailbody, pls help

    • @Alexander-dj1jp
      @Alexander-dj1jp 3 года назад +2

      I actually fixed it myself: "i put this in bodyPart.setContent(emailBody, "text/html;charset=UTF-8);

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

      You can check code on git repository mentioned in this video detail section. Hope you were able to send email successfully via this code 👍🏻

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

      @@Alexander-dj1jp thank uu

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

      is it working?

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

    How do i set up the jar files?

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

      Pls check if this helps .. I have explained how to use java jars here and jars for mailing service has been explained in this video itself. ruclips.net/video/yOvDrn3Z484/видео.html

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

    how can i add signature and closing to mail?

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

      You need to add signature in the multipart .

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

    Hi...how to send bulk emails ?

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

      If you want to send email to multiple recipient .. just add them in the recipient array separated by comma.

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

    What does those jar files do ?

    • @Mr.noname_
      @Mr.noname_ 5 месяцев назад

      none of your business

    • @rahulmistry5381
      @rahulmistry5381 5 месяцев назад

      @@Mr.noname_ You dumb, do you even understand what I asked, that you are commenting "none of your business" ?

    • @rahulmistry5381
      @rahulmistry5381 5 месяцев назад

      Can't you see what I've commented that you've commented "none of your business" ?

    • @rahulmistry5381
      @rahulmistry5381 5 месяцев назад

      Also, why you deleted my comment ?

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

    is it maven based

  • @CodeTechGyan
    @CodeTechGyan  4 года назад +2

    Learn how to send an attachment with slight modification ruclips.net/video/3KXnB2oqt1k/видео.html

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

      No need of another video.
      Because attachment code is an single line code
      MimeBodyPart attachment= new MimeBodyPart();
      attachment. attachFile("your file name");
      Okk

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

    why don't You show The emails
    Don't watch this Videos 😕 waist of ⌚ U know what wanna Say😳

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

      I have shown emails at the end of this video with hidden mailing ids. While you are executing this code you can use email Id of your choice and get the mails. Hope this helps . Thanks !!

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

    I am getting exception that username and pasword not accepted. What should i do?