Receiving email in Java
For receiving email Store and Folder classes are used in collaboration with MimeMessage, Session and Transport classes.
For better understanding of this example, learn the steps of sending email using JavaMail API first.
For sending the email using JavaMail API, you need to load the two jar files:
Steps for receiving the email using JavaMail API
There are 5 steps to receive the email using JavaMail API. They are:
Example of Receiving email in Java
Let's see the example of receiving the mail using java mail api.
As you can see in the above example, userid and password need to be authenticated. As, this program illustrates, you can receive email easily but change the username and password accordingly. Let's see how to run it once again by simple technique: