Hi,
    Thanks a lot for your help. Sending multiple attchments is not a problem. Let me 
check it up, how your code can be used  for receving the multiple files. thanks a lot 
any way.
Smita

Quoting  Vikramjit Singh <[EMAIL PROTECTED]>:

> hi smita,
> this code i have used for sending multiple attachments. i don tthink
> that
> there will be much code diff. for reading the mail
>
> for(int i=0;i<attachmentArrayList.size();i++)
>                                 {
>                                         // This is for displaying the
> name
> of the attachment
>                                         String attach =
> (String)attachmentArrayList.get(i);
>
>                                         int start =
> attach.lastIndexOf("/");
>                                         nameOfAttachment =
> attach.substring(start+1);
>
> System.out.println(nameOfAttachment);
>                                         // This part of the code is for
> attaching the file to the message
>                                         messageBodyPart = new
> MimeBodyPart();
>                                         source = new
> FileDataSource(attach);
>
> messageBodyPart.setDataHandler(new
> DataHandler(source));
>
>                                         /* This code within the try and
> catch block gives you the size of the individual attachment. This is
> done so
> that the size of the attachments dont exceed the individual mail limit
> of
> mailbox
>                                         */
>                                         try
>                                         {
>                                                 fis = new
> FileInputStream(attach);
>                                                 int len1 =
> fis.available();
>                                                 System.out.println("The
> size
> of the file is = "+len1);
>                                         }
>                                         catch(FileNotFoundException
> fnfe)
>                                         {
>                                                 fnfe.printStackTrace();
>                                         }
>                                         catch(Exception e)
>                                         {
>                                                 e.printStackTrace();
>                                         }
>
> Vikramjit singh,
> eAngel Team,
> Global Tele-systems Ltd.
> Ph. 7612929-3140
>
>
> -----Original Message-----
> From: Smita Kotnis [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 20, 2001 2:19 AM
> To: [EMAIL PROTECTED]
> Subject: Receiving a mail from SMTP server
>
>
> Hi all,
>         I am using JavaMail in my JSP to receive the mails from SMTP
> server.
> How
> to receive a mail from SMTP server with attachments? Any piece of code
> will
> be
> appreciated. Thanks in advance.
> Smita
>
> -------------------------------------------------
> This mail sent through : http://mail.sify.com
>
> ===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
> ===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>

-------------------------------------------------
This mail sent through : http://mail.sify.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to