Skip to Content
author's profile photo Former Member
Former Member

Very Urgent Please Help me

hi all

i am trying to intigrate email functionality in Abstract Portal component

I am getting error message

this is my code

String myhost = "USCNT0417";

String mailfrom = "srinivasrao@mailcity.com";

String mailto = "asomayajula@deloitte.com" ;

String subject = "This is test message";

String mailmessage = "Hi This is the message i am sending from the Abstract portal component object" ;

InitialContext ctx = null;

MimeBodyPart bodyPart = null;

Address[] address = null;

// Message msg = null;

//Multipart mp = null;

Transport tr = null;

Session sess = null ;

try {

ctx = new InitialContext();

sess = (Session) javax.rmi.PortableRemoteObject.narrow(initctx.lookup("java:comp/env/mail/MailSession"), request.getComponentSession().getHttpSession().getClass());

//sess = (Session) javax.rmi.PortableRemoteObject.narrow(ctx.lookup("MailSession"), Session.class);

//Message msg = new MimeMessage(sess);

Message msg = new MimeMessage(sess);

msg.setFrom(new InternetAddress(mailfrom));

// msg.setRecipients(Message.RecipientType.TO, extractRecipientAddresses(mailto));

msg.setSubject(subject);

msg.setRecipient(Message.RecipientType.TO,new InternetAddress(mailto));

msg.setContent(mailmessage, "text/plain");

msg.setSentDate(new GregorianCalendar().getTime());

msg.saveChanges();

tr = sess.getTransport("smtp");

tr.connect(myhost, "", "");

address = msg.getAllRecipients();

tr.sendMessage(msg, address);

tr.close();

response.write("your mail was delevered");

}catch(Exception E){response.write("your mail was not delevered the error is :" + E.toString());}

if this works i has to copy this code into main class and has to use runtime parameters

thank u

regards

srinivas ayyala

Add comment
10|10000 characters needed characters exceeded

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Apr 14, 2004 at 05:52 PM

    I am sorry i did'nt mention error message

    it is

    javax.mail.Message

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 15, 2004 at 03:13 PM

    yes thank you for reply

    i am getting class not found exception

    javax/mail/message is not found

    can u help me by telling how to set theese setting

    i am using eclips

    regards

    srinivas

    Add comment
    10|10000 characters needed characters exceeded