We can send mail through JavaMail Api through java code.I have read somewhere and thought of sharing with everyone.
For using this code you need to JavaMail Api.
//get mail session
Properties props = new Properties();
props.put("mail.smtp.host","localhost");
Session session = session.getDefaultInstance(props);
// create the messge.
MimeMessage message = new MimeMessage(session);
message.setSubject("Vinay first Mail");
Message.setText("Vinay mail text ");
//address the message
InternetAddress addfrm = new InternetAddress("vinaycen@gmail.com");
message.setFrom(addfrm);
InternetAddress addto = new InternetAddress("vinaycen@yahoo.com");
message.setRecipient(Message.RecipientType.TO,addto);
//send message
Transport.send(message);
Update
Send email in text and html format Text and HTML format

Rommel Sharma
To add to the above – not to forget the essentials:
The Java Mail API used here is like a Mail User Agent. In the example above you need the mail transfer agent – that in this example assumes ‘localhost’.
Please give your SMTP server address that acts as the MTA, without which it would not work.
Rest looks good.
Cheers,
Rommel.
Ahmad
What about adding attachments?
waqas ali
sir, i need help and source code form you about (“sending text from pc without using a fax machine”).