File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other JSE/JEE APIs and the fly likes how to send more than one attachment with javamail Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "how to send more than one attachment with javamail" Watch "how to send more than one attachment with javamail" New topic
Author

how to send more than one attachment with javamail

albert sie
Ranch Hand

Joined: Jan 15, 2006
Posts: 108
i want to know that how i can send out more than 1 attachment by using javamail API in a message???


JAVA the only can called technology
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41600
    
  55
A quick search through the archive of this forum finds this post.


Ping & DNS - my free Android networking tools app
albert sie
Ranch Hand

Joined: Jan 15, 2006
Posts: 108
i want not just send out the attachment. what i want is send out many of attachment in 1 message
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41600
    
  55
Not sure what you mean (an attachment is never sent on its own, it's alwayws part of a message). The example shows how to add one attachment - just duplicate the code to add as many attachments as you want.
vivien siu
Ranch Hand

Joined: Nov 10, 2005
Posts: 143
you just need to use MimeMultipart object in your java mail.

then for every attachment, just add a BodyPart object(which has the file path for the attachment) to the Multipart object.

MimeMultipart mp = new MimeMultipart();
mp.addBodyPart(mbp1);//just keep call this method to add your attachment to the MimeMultipart object

yeah you should follow Ulf's link as well, the source code shows you how to get the attachment and attach it to your javamail
[ March 10, 2006: Message edited by: vivien siu ]

I'm not available, my BF's name is WORK.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to send more than one attachment with javamail