How To Send a Plain Text EMail in Java using JavaMail API ?

Java Mail API is used to create your own email client. This class provides the code required to model your email client similar to Outlook, Hotmail and many others. In JavaMail you’ll find APIs and provider implementations allowing you to develop fully functional email client applications. Below java program shows you how to send a plain text email using JavaMail API.

 * Created on Apr 18, 2014. Copyright(c) All Rights Reserved.
package com.kodehelp.javax.mail;

import java.util.Properties;

import javax.mail.Message;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;

 * @author
public class SendEmail {

	 * @param args
	public static void main(String[] args) {
		final String FROM = "demo@"; //From email address
		final String TO = "demo@"; // To email Address
		final String SUBJECT = "Email sent using Java Mail API";
		final String CONTENT = "Hello, This is email is the test email sent from's Java Mail API example.";

		final String SMTP_HOST = "";
		final String SMTP_PORT = "465";
		final String EMAIL_PROTOCOL = "smtp";

		//Properties is used to store the email configurations such as mail protocol, SMTP host, SMTP port and many others
		Properties prop = new Properties();
		prop.put("", SMTP_HOST);
		prop.put("mail.smtp.port", SMTP_PORT);
		prop.put("mail.transport.protocol", EMAIL_PROTOCOL);
		prop.put("mail.debug", "true");

		Session session = Session.getDefaultInstance(prop);

		try {
			InternetAddress fromAddress = new InternetAddress(FROM);
			InternetAddress toAddress = new InternetAddress(TO);

			Message message = new MimeMessage(session);
			message.setRecipient(Message.RecipientType.TO, toAddress);
			Transport.send(message, "[email protected] .com", "password");

		}catch(Exception e){