Thank you very much for very informative learning video , i tried Enabling "Less Secure app access " but its showing message as " This setting is no longer available " please suggest an alternate
Thanks for the walk through, it helped me out a lot. Just to point out the jar files you need is the javax.mail and activation.jar. Also the password you need to insert is not your regular password, it is a auto generated 13char that you can get in your google account under app passwords.
i have always this exception: xception in thread "main" java.lang.NoClassDefFoundError: javax/activation/DataHandler at MyMail.main(MyMail.java:26) WHY???
@@WittCode if i try to send more than one email to same account in short time ,i would got time out error,is this normal?how can i solve this problem?
@@prometheusli101 Hmmm... if it is a timeout error I believe you can specify timeout properties like the others in the video. Try adding these and changing the number value: properties.put("mail.smtp.timeout", "1000"); properties.put("mail.smtp.connectiontimeout", "1000"); properties.put("mail.smtp.writetimeout", "1000");
Hey there Abdelouahid! I don't believe so but you could just make a method that does this to make things simpler! Make a method like attachMyFile() that just repeats the process of making a mimebodypart! Let me know if this helps! 😁
3 роки тому
hi WiitCode ; got "Cannot resolve method 'getInstance' in 'Session'" and so on 'Authenticator' is abstract; cannot be instantiated is it a problem of API version, SK, NDK or the library ? thanks for your help
Hey there! Did you import the right Session class? Go to the top of the page at your imports and make sure it is the javax.mail.Session and not another one!
3 роки тому
@@WittCode thanks..sorry
3 роки тому
at the end when i Run it "Process finished with exit code 1" so i got a lot log .. Exception in thread "main" javax.mail.MessagingException: IOException while sending message; nested exception is: java.io.IOException: No MimeBodyPart content at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1365) at javax.mail.Transport.send0(Transport.java:255) at javax.mail.Transport.send(Transport.java:124) at fr.jeredez.myapplication.MyEmail.main(MyEmail.java:56) Caused by: java.io.IOException: No MimeBodyPart content at javax.mail.internet.MimePartDataSource.getInputStream(MimePartDataSource.java:116) at javax.activation.DataHandler.writeTo(DataHandler.java:305) at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1694) at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:996) at javax.mail.internet.MimeMultipart.writeTo(MimeMultipart.java:561) at com.sun.mail.handlers.multipart_mixed.writeTo(multipart_mixed.java:84) at javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:889) at javax.activation.DataHandler.writeTo(DataHandler.java:317) at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1694) at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1913) at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1315) ... 3 more Caused by: javax.mail.MessagingException: No MimeBodyPart content at javax.mail.internet.MimeBodyPart.getContentStream(MimeBodyPart.java:618) at javax.mail.internet.MimePartDataSource.getInputStream(MimePartDataSource.java:100) ... 13 more
@ Of the errors you sent me usually the one that is important is the one that contains info about your java file which seems to be called MyEmail.java? The error is thrown on line 56 and it is because you have no content in the email you are trying to send!
3 роки тому
@@WittCode okay i'm so dumb ; i typed attachment.setContent instead of messageBodyPart.setContent ...
Hey Nelson! I am not 100% sure but if you use the same Java libraries I don't see why it wouldn't work! There might just be some extra permissions or something you need to work with. 😃
Hey Ali! I will be posting the source code to a lot of videos when I get my personal computer working again haha I'm using my work computer and I don't want to mess with the git settings!
javax.mail.MessagingException: Exception reading response; nested exception is: javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate) How to solve this?
Hey Deepak! This must be something to do with setting up the session in the video. For the properties object did you specify the protocol to be smtp? I believe it is properties.put("mail.transport.protocol", "smtp");
Very helpful! However, I am still getting the following issue. Looks like I need JavaBean Activation, but I can’t figure out how to download it. How do I fix this: Exception in thread "main" java.lang.NoClassDefFoundError: javax/activation/DataHandler at SendEmail.main(SendEmail.java:24) Caused by: java.lang.ClassNotFoundException: javax.activation.DataHandler at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522) ... 1 more
Man, you have the best tutorial on the topic "how to send an email using Java". Thank you)
Thanks WittCode! I like how you always explain everything!!!!
Hey John! Thanks! That's my style haha 🤠
What a perfect synopsis on this topic. Well done 10/10
Thank you so much. Short, simple explanation that worked for me once I set Gmail less secure app password setting in Gmail. Awesome.
Glad it helped! Thanks for watching!
Thank you very much for very informative learning video , i tried Enabling "Less Secure app access " but its showing message as " This setting is no longer available " please suggest an alternate
Perfect explanation. Extremely helpful!
man thank you for making videos, they are always easy to understand!
the "Less secure..." in gmail has been disabled, so your program will no longerwork. If you have a solution, I'm sure we would all like to see it.
Thanks for the walk through, it helped me out a lot. Just to point out the jar files you need is the javax.mail and activation.jar. Also the password you need to insert is not your regular password, it is a auto generated 13char that you can get in your google account under app passwords.
could you send me the code? did not work for me
exactly what I am looking for. Thank you so much. Very good explanation
Hello! I have a question: What method should I use for attachment: setcontent() or setDataHandler?
Google recently removed support for the Less Secure Apps option. Can you still use the gMail SMTP to send emails?
Yes, Now you can get from google password app.
Thanks a lot for sharing your knowledge!
Great video!
Hey Engku thanks for watching and the support! 🤠
Thanks for this! Can I request for the link of mail jar file
is there any chance that you dont need to enable the less secure app setting on the account that will receive the email?
Will you please help me how to solve the “JPasswordField get deprecated”
In Java swing JFrame project??
🙏🙏🙏
very thanks!
Thank you
Sir, how to get response in sender side if button is sent in mail message is clicked in java mail api
plz help sir
how can i add signature and closing to mail?
Thanks❤️
i have always this exception: xception in thread "main" java.lang.NoClassDefFoundError: javax/activation/DataHandler
at MyMail.main(MyMail.java:26) WHY???
i get the same error: does anyone have a fix for this?
awesome! very useful
Hey good to hear from you again! Thanks for watching 🤠
@@WittCode 😁😄
@@WittCode if i try to send more than one email to same account in short time ,i would got time out error,is this normal?how can i solve this problem?
@@prometheusli101 Hmmm... if it is a timeout error I believe you can specify timeout properties like the others in the video. Try adding these and changing the number value: properties.put("mail.smtp.timeout", "1000");
properties.put("mail.smtp.connectiontimeout", "1000");
properties.put("mail.smtp.writetimeout", "1000");
@@WittCode thanks for your help,but this is not the solution,just ignore my question.i think this was google preset
Thank Bro!
Of course Walter! Thanks for watching! 😁
thank you but how i can send a file in virtual machine
is there a way to send multiple attachments more than 10 without repeating the mimepodypart for every single attachment
Hey there Abdelouahid! I don't believe so but you could just make a method that does this to make things simpler! Make a method like attachMyFile() that just repeats the process of making a mimebodypart! Let me know if this helps! 😁
hi WiitCode ; got "Cannot resolve method 'getInstance' in 'Session'" and so on 'Authenticator' is abstract; cannot be instantiated
is it a problem of API version, SK, NDK or the library ? thanks for your help
Hey there! Did you import the right Session class? Go to the top of the page at your imports and make sure it is the javax.mail.Session and not another one!
@@WittCode thanks..sorry
at the end when i Run it "Process finished with exit code 1"
so i got a lot log
..
Exception in thread "main" javax.mail.MessagingException: IOException while sending message;
nested exception is:
java.io.IOException: No MimeBodyPart content
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1365)
at javax.mail.Transport.send0(Transport.java:255)
at javax.mail.Transport.send(Transport.java:124)
at fr.jeredez.myapplication.MyEmail.main(MyEmail.java:56)
Caused by: java.io.IOException: No MimeBodyPart content
at javax.mail.internet.MimePartDataSource.getInputStream(MimePartDataSource.java:116)
at javax.activation.DataHandler.writeTo(DataHandler.java:305)
at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1694)
at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:996)
at javax.mail.internet.MimeMultipart.writeTo(MimeMultipart.java:561)
at com.sun.mail.handlers.multipart_mixed.writeTo(multipart_mixed.java:84)
at javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:889)
at javax.activation.DataHandler.writeTo(DataHandler.java:317)
at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1694)
at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1913)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1315)
... 3 more
Caused by: javax.mail.MessagingException: No MimeBodyPart content
at javax.mail.internet.MimeBodyPart.getContentStream(MimeBodyPart.java:618)
at javax.mail.internet.MimePartDataSource.getInputStream(MimePartDataSource.java:100)
... 13 more
@ Of the errors you sent me usually the one that is important is the one that contains info about your java file which seems to be called MyEmail.java? The error is thrown on line 56 and it is because you have no content in the email you are trying to send!
@@WittCode okay i'm so dumb ; i typed attachment.setContent instead of messageBodyPart.setContent ...
Hello Sir, works in JAVA Android ? Great video.
Hey Nelson! I am not 100% sure but if you use the same Java libraries I don't see why it wouldn't work! There might just be some extra permissions or something you need to work with. 😃
Good
how to attach selected files without mentioning in file
brother can you give its source code
Hey Ali! I will be posting the source code to a lot of videos when I get my personal computer working again haha I'm using my work computer and I don't want to mess with the git settings!
I got solution now 😅 after whole day writing your code
Can I get your WhatsApp number if you don't mind
@@theexploreaustralia haha sorry about that man 😀
javax.mail.MessagingException: Exception reading response;
nested exception is:
javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
How to solve this?
Hey Deepak! This must be something to do with setting up the session in the video. For the properties object did you specify the protocol to be smtp? I believe it is properties.put("mail.transport.protocol", "smtp");
@@WittCode yes I did everything what you said in your video
it could be that your antivirus is blocking you
Very helpful! However, I am still getting the following issue. Looks like I need JavaBean Activation, but I can’t figure out how to download it. How do I fix this:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/activation/DataHandler
at SendEmail.main(SendEmail.java:24)
Caused by: java.lang.ClassNotFoundException: javax.activation.DataHandler
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 1 more
Hey Jonathan! This seems like an issue loading the Java mail api. Are you using maven and IntelliJ or just IntelliJ?
@@WittCode Oh, I got it figured it out. Thank you so much for the quick response!
@@WittCode hey i get the same error and I'm using intelliJUltimate, do u know how I can fix this ? :))) //longtime subscriber
how can i add signature and closing to mail?