Send Email using Core Java

To send email using core java first of all you required JavaMail API in your computer. You can download lates version of JavaMail API.

Download and extract files from file. Here you will find mail.jar file. For successfully run below example you need to set CLASSPATH to this jar file.

Send Email using Core Java Sample Code

Step 1 : Compile file

javac -cp “Path to mail.jar file”

Step 2 : Run SendMail with Java

java -cp “Path to;Path to mail.jar file” SendMail