sedn email problem-----need help
843830Dec 1 2002 — edited Dec 2 2002Why this is not working
--------------------------
import java.util.Properties;
import javax.mail.*;
import javax.mail.internet.*;
public class Mailklasa {
public static void main (String args[]) throws Exception {
String host = "out.mail.bih.net.ba";
String from = "asimv@bih.net.ba";
String to = "asimv@bih.net.ba";
// Get system properties
Properties props = System.getProperties();
// Setup mail server
props.put("out.mail.bih.net.ba", host);
// Get session
Session session = Session.getDefaultInstance(props, null);
// Define message
MimeMessage message = new MimeMessage(session);
// Set the from address
message.setFrom(new InternetAddress(from));
// Set the to address
message.addRecipient(Message.RecipientType.TO,
new InternetAddress(to));
// Set the subject
message.setSubject("Hello JavaMail");
// Set the content
message.setText("Welcome to JavaMail");
// Send message
Transport.send(message);
}
}