Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Java in General
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Java in General
Multiple Attachments for EMail Message
Steve Dyke
Ranch Hand
Posts: 2206
2
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
For some reason the folloing code produces an email containing two files with the same name( name of the last file in the array). One will have the appearance of a pdf file the other a generic icon appearance.
if(attachment!=null){ String[] atarray = attachment.split(","); int i = 0; for(i=0;i<atarray.length;i++){ System.out.println(atarray[i]); FileDataSource fds = new FileDataSource(atarray[i]); p2.setDataHandler(new DataHandler(fds)); p2.setFileName(fds.getName()); mp.addBodyPart(p2); } }
>
Martijn Verburg
author
Posts: 3285
13
I like...
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I have severe lack of
coffee
but here's a possible hint, Think about what's happening to p2......
Cheers, Martijn,
Twitter
.
Steve Dyke
Ranch Hand
Posts: 2206
2
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Thanks, I finally figured that p2 has to be defined as new on each iteration. Works great. Thanks for the help.
Martijn Verburg
author
Posts: 3285
13
I like...
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
No worries Steve, I was pretty sure you'd spot it
Cheers, Martijn,
Twitter
.
Did you see how Paul
cut 87% off of his electric heat bill with 82 watts of micro heaters
?
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
setting content in email with attachment JavaMail
problem with java mail attachment
Javamail: Problem sending attachments
How to send email with no attachment?
How to attach a TextFile as a File?
More...