Hai everyone,
     I could configure the file in James.After that the james server is running properly and i could see "Avalon runner".Then i added some of the localusers in server by using telnet. But while sending mails to the user name i couldn't receive it.I have send the mail sending program below.What to give in the "host" field ?
 
Here is the mail sending program,
 
 
 
import java.util.*;
import java.io.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;
 

public class sendfile {
 
    public static void main(String[] args) {
 file://if (args.length != 5) {
     file://System.out.println("usage: java sendfile <to> <from> <smtp> <file> true|false");
     file://System.exit(1);
 file://}
 
 String to = "mathav";
 String from = "[EMAIL PROTECTED]";
 String host = "localhost";
 String filename = "c:/mathav/ical.html";
 file://boolean debug = Boolean.valueOf(args[4]).booleanValue();
 String msgText1 = "Sending a file.\n";
 String subject = "Sending a file";
 
 // create some properties and get the default Session
 Properties props = System.getProperties();
 props.put("mail.smtp.host", host);
 
 Session session = Session.getDefaultInstance(props, null);
 file://session.setDebug(debug);
 
 try {
  
  /*Store store = ;
 
  Folder f=store.getFolder("[EMAIL PROTECTED]");
  if(f.exists()){System.out.println("Mathav is available");}*/
     // create a message
     MimeMessage msg = new MimeMessage(session);
     msg.setFrom(new InternetAddress(from));
     InternetAddress[] address = {new InternetAddress(to)};
     msg.setRecipients(Message.RecipientType.TO, address);
     msg.setSubject(subject);
 
     // create and fill the first message part
     MimeBodyPart mbp1 = new MimeBodyPart();
     mbp1.setText(msgText1);
 
     // create the second message part
     MimeBodyPart mbp2 = new MimeBodyPart();
 
            // attach the file to the message
        FileDataSource fds = new FileDataSource(filename);
     mbp2.setDataHandler(new DataHandler(fds));
     mbp2.setFileName(fds.getName());
 
     // create the Multipart and its parts to it
     Multipart mp = new MimeMultipart();
     mp.addBodyPart(mbp1);
     mp.addBodyPart(mbp2);
 
     // add the Multipart to the message
     msg.setContent(mp);
 
     // set the Date: header
     msg.setSentDate(new Date());
    
     // send the message
     Transport.send(msg);
    
 } catch (MessagingException mex) {
     mex.printStackTrace();
     Exception ex = null;
     if ((ex = mex.getNextException()) != null) {
  ex.printStackTrace();
     }
 }
    }
}
 
My James server is running in the local system.Whether name int the "To" is the name what i have given in the Telnet Address?And what i have entered in the  "Host" filed is correct?
 
Can anyone check it and give me their suggestions??
 
N.Mathavaraj

Reply via email to