- JBoss 4.2.3
- Mail Server: x2cpt.webappcabaret.net
My code is the following
String to = "thompsonluque@ymail.com"; // email that receive the feedback
String from = email; // email that send the feedback
String host = "www.myluque.com";
String stmp = "x2cpt.webappcabaret.net";
// Get system properties
Properties properties = System.getProperties();
// Setup mail server
properties.setProperty(stmp, host);
// Get the default Session object.//
Session session = Session.getInstance(properties, null);
try{
// Create a default MimeMessage object.
MimeMessage message = new MimeMessage(session);
// Set From: header field of the header.
message.setFrom(new InternetAddress(from));
// Set To: header field of the header.
message.addRecipient(Message.RecipientType.TO,new InternetAddress(to));
// Set Subject: header field
message.setSubject(subject);
// Now set the actual message
message.setText(messagea);