Hello James Server.
I have downloaded James Server2.3.2, and i am not able to send an email.
How do i configure this the program i used to send mail. Please help me.
package com.ibm.dashboard;
import java.util.Properties;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;
public class MailAttach {
public static void main (String args[])
throws Exception {
String host = "localhost";
String from = "raghurama.j@localhost";
String to = "[email protected]";
String fileAttachment = "c:/WEB2_ROLESDB.log";
// Get system properties
Properties props = System.getProperties();
// Setup mail server
props.put("mail.smtp.host", host);
props.put("mail.smtp.port", 25);
// Get session
Session session =
Session.getInstance(props, null);
// Define message
MimeMessage message =
new MimeMessage(session);
message.setFrom(
new InternetAddress(from));
message.addRecipient(
Message.RecipientType.TO,
new InternetAddress(to));
message.setSubject(
"Hello JavaMail Attachment");
// create the message part
MimeBodyPart messageBodyPart =
new MimeBodyPart();
//fill message
messageBodyPart.setText("Hi");
Multipart multipart = new MimeMultipart();
multipart.addBodyPart(messageBodyPart);
// Part two is attachment
messageBodyPart = new MimeBodyPart();
DataSource source =
new FileDataSource(fileAttachment);
messageBodyPart.setDataHandler(
new DataHandler(source));
// messageBodyPart.setFileName(fileAttachment);
multipart.addBodyPart(messageBodyPart);
// Put parts in message
message.setContent(multipart);
System.out.println("sending msg ..");
// Send the message
Transport.send( message );
System.out.println("msg sent.");
}
}