Send email using java code tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 9 พ.ย. 2024

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

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

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

  • @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

  • @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  3 ปีที่แล้ว

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

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

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

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

    Please subscribe our channel ☺️

  • @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

  • @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 😉

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

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

  • @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

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

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

  • @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.

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

    thank you so much..

  • @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

  • @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.

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

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

  • @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 .

  • @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. th-cam.com/video/yOvDrn3Z484/w-d-xo.html

  • @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.

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

    how can i add signature and closing to mail?

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

      You need to add signature in the multipart .

  • @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 ?

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

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

  • @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 ปีที่แล้ว

      is it working?

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

    is it maven based

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

    Learn how to send an attachment with slight modification th-cam.com/video/3KXnB2oqt1k/w-d-xo.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?