Java Mail API Message
by, 04-25-2012 at 10:51 PM (769 Views)
When session object has been created, message is created so that to send it by the help of Message class. As message class is considered as abstract class hence subclass javax.mail.internet.MimeMessage will be used.
setText() method can also be used to set the content.Java Code:MimeMessage message = new MimeMessage(session) // set the content of message by setContent() method message.setContent(“[url]www.xyz.net”[/url], “text/plain”);
Use setSubject() method for creating subject line to send messages.Java Code:Message.setText(“[url]www.xyz.net”);[/url]
Java Code:Message.setSubject(“Its Urgent Message”);