Short and dirty copy and paste for sending a simple text mail using javamail here
A small example of sending a text message using a custom smtp host:
Properties props = new Properties();
props.put("mail.smtp.host", "your.mailhost.com");
Session session = Session.getDefaultInstance(props, null);
session.setDebug(true);
Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress("mail@from.com"));
msg.setRecipients(Message.RecipientType.TO, new InternetAddress[]{new InternetAddress("mail@to.com")});
msg.setSubject("Subject Line");
msg.setText("Text Body");
Transport.send(msg);
source
share