You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-user@james.apache.org by =gaurav <ga...@amsoft.net> on 2005/09/21 17:08:32 UTC

Have to open mail attachment for reading.

Hi All,

 

I am having James 2.2.0 running. I need to open the attachment which I am
sending with the mail to James SMTP Server. 

I am able to get the name of attachment file to be displayed on console by
creating an object of HasAttachment class as follows:

 

HasAttachment attachment = new HasAttachment();

Collection  col = (Collection)attachment.match(mail);

System.out.println("Returned value from match method is "+col.toString());

String file =  attachment.fileName1;

System.out.println("Attached file is: "+attachment.fileName1);

 

But I need to read the text present in the attachment. For this I need to
open the file. 

Can anyone help me out in finding a way to open the file attachment sent
with the mail?

 

 

Thanks,

Gaurav Handa

cell +91-9868867223

 


Re: Have to open mail attachment for reading.

Posted by Danny Angus <Da...@slc.co.uk>.
You really need to understand JavaMail to do this, not James,
you get a MimeMessage in a mailet like this:

MimeMessage message = new MimeMessage(mail.getMessage());

see http://www.jguru.com/faq/view.jsp?EID=26996





|---------+---------------------------->
|         |           "=gaurav"        |
|         |           <gaurav.handa@ams|
|         |           oft.net>         |
|         |                            |
|         |           21/09/2005 16:08 |
|         |           Please respond to|
|         |           "James Users     |
|         |           List"            |
|---------+---------------------------->
  >-------------------------------------------------------------------------------------------------------------------------------|
  |                                                                                                                               |
  |       To:       <se...@james.apache.org>                                                                                |
  |       cc:                                                                                                                     |
  |       Subject:  Have to open mail attachment for reading.                                                                     |
  >-------------------------------------------------------------------------------------------------------------------------------|




Hi All,



I am having James 2.2.0 running. I need to open the attachment which I am
sending with the mail to James SMTP Server.

I am able to get the name of attachment file to be displayed on console by
creating an object of HasAttachment class as follows:



HasAttachment attachment = new HasAttachment();

Collection  col = (Collection)attachment.match(mail);

System.out.println("Returned value from match method is "+col.toString());

String file =  attachment.fileName1;

System.out.println("Attached file is: "+attachment.fileName1);



But I need to read the text present in the attachment. For this I need to
open the file.

Can anyone help me out in finding a way to open the file attachment sent
with the mail?





Thanks,

Gaurav Handa

cell +91-9868867223






***************************************************************************
The information in this e-mail is confidential and for use by the addressee(s) only. If you are not the intended recipient (or responsible for delivery of the message to the intended recipient) please notify us immediately on 0141 306 2050 and delete the message from your computer. You may not copy or forward it or use or disclose its contents to any other person. As Internet communications are capable of data corruption Student Loans Company Limited does not accept any  responsibility for changes made to this message after it was sent. For this reason it may be inappropriate to rely on advice or opinions contained in an e-mail without obtaining written confirmation of it. Neither Student Loans Company Limited or the sender accepts any liability or responsibility for viruses as it is your responsibility to scan attachments (if any). Opinions and views expressed in this e-mail are those of the sender and may not reflect the opinions and views of The Student Loans Company Limit
 ed.

This footnote also confirms that this email message has been swept for the presence of computer viruses.

**************************************************************************

---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org