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 = "";

String mailto = "" ;

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.setRecipient(Message.RecipientType.TO,new InternetAddress(mailto));

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

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


tr = sess.getTransport("smtp");

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

address = msg.getAllRecipients();

tr.sendMessage(msg, address);


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


srinivas ayyala

Add a comment
10|10000 characters needed characters exceeded

Related questions

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


    Add a 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



    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.