File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Multiple Attachments for EMail Message Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Multiple Attachments for EMail Message" Watch "Multiple Attachments for EMail Message" New topic
Author

Multiple Attachments for EMail Message

Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1391
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.

>
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

I have severe lack of coffee but here's a possible hint, Think about what's happening to p2......


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1391
Thanks, I finally figured that p2 has to be defined as new on each iteration. Works great. Thanks for the help.
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

No worries Steve, I was pretty sure you'd spot it
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Multiple Attachments for EMail Message
 
Similar Threads
How to attach a TextFile as a File?
setting content in email with attachment JavaMail
Javamail: Problem sending attachments
How to send email with no attachment?
problem with java mail attachment