Users can write, read and compose emails with different attachments using JavaMail API.
The JavaMail API is used to compose, write and read emails.
We require an initial setup to send an email. If you are using Maven Project you must add some dependencies to your pom.xml. You can get that dependency here: com.sun.mail/javax.mail/1.6.2.
Before running your Java application, make sure you should be connected to the internet and allow less secure apps permission in your Gmail security settings.
To send a message we are using a subclass of Message class (MimeMessage) is instantiated. A session class represents an email session. An abstract class Transport that models a message. A protocol to deliver an email.