Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

sedn email problem-----need help

843830Dec 1 2002 — edited Dec 2 2002
Why 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);
}
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 30 2002
Added on Dec 1 2002
2 comments
209 views