• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem with mailing attachments  RSS feed

 
K DeLucia
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can someone tell me what is wrong with the below code. I have a web application where people can upload files. The filenames are put into a list. Then I loop through the list and for each file, I attach it to an email and send the email. All my print statements seem to indicate that it is processing and attaching the correct files, but when the email is received, only one of the attachments is included, but multiple times.

For instance, if I upload file1.txt and file2.txt, when the email is received, it comes in with two file attachments (like it should) but both of them are file2.txt.

I'm sure I've done something stupid, but I just can't see it. Any ideas are welcome!

 
Paul Clapham
Sheriff
Posts: 22844
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You only create one MimeBodyPart but then you use it for all of the attachments. You need one MimeBodyPart per attachment.
 
K DeLucia
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Makes sense. I knew it was something simple. I'll give it a try. Thanks a bunch!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!