Hi Need Help With my java mail code

import com.sun.midp.io.Properties;

import java.util.*;

import javax.mail.internet.*;

import javax.mail.*;

publicclass TestMail{

static String

d_host ="smtp.gmail.com",

d_port ="465",

d_password = null,

d_email =null;

staticint authorize = 1;

static Transport bus;

privateclass SMTPAuthenticatorextends javax.mail.Authenticator{

public PasswordAuthentication getPasswordAuthentication(){

returnnew PasswordAuthentication(d_email, d_password);

}

}

public TestMail(String msg_txt, String m_tos, String email, String pass, String subject){

d_password = pass;

d_email = email;

Properties props =new Properties();

props.addProperty("mail.smtp.user", d_email);

props.addProperty("mail.smtp.host", d_host);

props.addProperty("mail.smtp.port", d_port);

props.addProperty("mail.smtp.starttls.enable","true");

props.addProperty("mail.smtp.auth","true");

//props.addProperty("mail.smtp.debug", "true");

props.addProperty("mail.smtp.socketFactory.port", d_port);

props.addProperty("mail.smtp.socketFactory.class","javax.net.ssl.SSLSocketFactory");

props.addProperty("mail.smtp.socketFactory.fallback","false");

SMTPAuthenticator auth =new SMTPAuthenticator();

Session session = Session.getDefaultInstance(props,auth);

try{

bus = session.getTransport("smtp");

}catch(NoSuchProviderException nspe){

nspe.printStackTrace();

}

try{

bus.connect();

}catch(AuthenticationFailedException e){

authorize = 0;

}catch(MessagingException mex){

mex.printStackTrace();

}

if (authorize == 1){

try{

// Get a Transport object to send e-mail

Message msg =new MimeMessage(session);

msg.setFrom(new InternetAddress(d_email));

InternetAddress[] address ={new InternetAddress(m_tos)};

msg.setRecipients(Message.RecipientType.TO, address);

msg.setRecipients(Message.RecipientType.CC,

InternetAddress.parse(m_tos,true));

msg.setRecipients(Message.RecipientType.BCC,

InternetAddress.parse(m_tos,false));

msg.setSubject(subject);

msg.setSentDate(new Date());

msg.setText(msg_txt);

bus.sendMessage(msg, address);

bus.close();

System.exit(0);

}catch (MessagingException mex){

mex.printStackTrace();

while (mex.getNextException() !=null){

Exception ex = mex.getNextException();

ex.printStackTrace();

if (!(exinstanceof MessagingException))break;

else mex = (MessagingException)ex;

}

}

}

}

}

i dont know how to create a session in j2me.. nid help pls.... im trying to convert this j2se code to j2me.... i have problem with the session... are there alternatives?

[5382 byte] By [Mark_Ramosa] at [2007-11-26 12:42:57]
# 1
See: http://developers.sun.com/techtopics/mobility/midp/articles/midp2network/
watertownjordana at 2007-7-7 16:18:11 > top of Java-index,Archived Forums,Socket Programming...