In this project, the user can enter receiver's email ID, subject, body of email and then send the email using Java Mail API.
Note: Before using this project's code you need to set sender's email ID and password in sendemail.java . Only then this code will work. Also, remember to disable google account security incase you are using gmail id to send email and also don't forget to check that javax.mail.jar is there or not. If it is not there and an error comes then you can download it from here and then add the jar file in libraries folder of your project.
Due to privacy reasons, in sendemail.java I have not given sender's email and password. But if you are using this project then you must update this sendemail.java file and find following code lines there and correct it:
String myAccountEmail = "Write sender's email here";
String password = "Write sender's password here";
After you have written right sender's email Id in myAccountEmail variable and right password of your sender's email Id in password variable then you are good to go. Also, make sure that you need to disable security in sender's gmail account settings also.
If you are giving your own (gmail) email id as sender's email id then,
- Go to your google account
- Go to security
- Turn on the Less secure Web App access because it is off by default.
- You are done now!