Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to send more than one attachment with javamail

 
albert sie
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want to know that how i can send out more than 1 attachment by using javamail API in a message???
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A quick search through the archive of this forum finds this post.
 
albert sie
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want not just send out the attachment. what i want is send out many of attachment in 1 message
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic