Attaching multiple MimeBodyParts to MimeMultipart but content is wrong

Hi,
The code builds two attachments which each contains different data. It's billing information for two different populations sent as a single email message to accounting. The problem is that both mime parts end up with the content of whichever part was added last. This is the code that builds the mime parts:
                    // Build student data attachment
                    InputStream _isStudent = new ByteArrayInputStream(studentData.getBytes());
                    BinaryDataSource bdataStudent = new BinaryDataSource(_isStudent);
                    DataHandler dhStudent = new DataHandler(bdataStudent);
                    MimeBodyPart b3 = new MimeBodyPart();
                    b3.setContentID("text/plain");
                    b3.setDataHandler(dhStudent);
                    b3.setFileName("students.txt");
                    b3.addHeader("Content-Transfer-Encoding", "base64");
                    mp.addBodyPart(b3);
                    // Build employee data attachment
                    InputStream _isEmployee = new ByteArrayInputStream(employeeData.getBytes());
                    BinaryDataSource bdataEmployee = new BinaryDataSource(_isEmployee);
                    DataHandler dhEmpl = new DataHandler(bdataEmployee);
                    MimeBodyPart b2 = new MimeBodyPart();
                    b2.setContentID("text/plain");
                    b2.setDataHandler(dhEmpl);
                    b2.setFileName("employees.txt");
                    b2.addHeader("Content-Transfer-Encoding", "base64");
                    mp.addBodyPart(b2);
In this order, both parts contain the employee data. If I swap them around, both parts will contain student data. Filename information is correct and the problem seems to be exclusively with the data handler.
The odd thing is that this code hasn't been changed and now it's suddenly not working. Nor has the JavaMail jarfile been changed. It's an older version so I downloaded and tried the latest and greatest 1.4.4 release. I didn't think that would make a difference, and it didn't.
Any ideas about what could be going on here?
Thanks,
Rob Tanner
Linfield College

I don't see anything obviously wrong with your code so my guess is that
one of your assumptions is wrong, e.g.,
1. That's not really the code that's running.
2. You're not really using the JavaMail jar file that you think you're using
(perhaps you're getting the Gnu version by accident?)
3. BinaryDataSource isn't working correctly. You might try replacing BinaryDataSource
with ByteArrayDataSource from JavaMail.

Similar Messages

  • I am trying to attach multiple photos to an email from my ipad 2. I can see how to do it from the camera and camera roll option,but not from the photos program. What am I missing? Thanx so much!

    I am trying to attach multiple photos to an email using ipad 2. I can see how to do it using the camera and camera roll ap...
    But not using the photos ap..which is where the photos are. Any help would be appreciated.!

    In an album in Photos touch the Edit button and then touch the desired photos (up to 5). A blue check appears in each selected photo. Next touch the Share button at the upper left and select Mail. This starts a email with the photos attached.

  • Attaching photos to Apple Mail - error when attaching multiple files

    Hello,
    My iPhoto just recently started giving me an error whenever I try to attach multiple files to Apple Mail. The error says:
    "Mail got an error: Can't get paragraph 8 of
    content of outgoing message id 321072192.
    Invalid index."
    The only option allowed is to cancel. When I look at my Apple Mail it has created a message with the first selected photo attached, but none of the other photos are there. Any ideas of how to correct this? Is this an email client issue?
    Thanks!

    Welcome to the Apple Discussions.
    This is a problem between iPhoto 4 and 10.5.
    The workaround is to use the Photo Browser on the new Message Window in Mail, just drag the pic over from there:
    Uploaded with plasq's Skitch!
    Regards
    TD

  • How do I attach multiple files from the pages app to my email

    I'm trying to attach multiple documents from the "Pages" app to my email.  I'm using an ipad.  It is only letting me attach one at a time and send each document as individual emails.  I would like to be able to send one email with all 4 documents at the same time.  Any suggestions?
    Another thought- When I go to my gmail app to compose an email, I have the following to send:
    to:
    cc:
    subject:
    But there is not a paperclip to click to attach any documents either.  Is this all connected and something in my ipad settings needs to be adjusted?

    You can only attach one file at a time to email in the Pages app
    You cannot attach files in the mail app. If you want to email a file, you do it from within the app where the file is saved such as what you did with Pages.

  • How do I create multiple TOC's (Tables of Contents) in one Pages document?

    I'd like to have multiple TOC's (Tables of Contents) in one document. This is useful for me because I'd like to have a TOC for the regular chapters, then a TOC for the procedures, then a TOC for the tables in the document (it's a tech manual that I am writing). How can I do this? Thanks for any help you can render, and have a nice day!

    fruhulda wrote:
    If you haven't used a paragraph style it can't create a TOC but you get the blue box with the message.
    Paragraph used.
    It has nothing to do if there is one main TOC or several smaller TOC to do.
    It isn't true that you can only have one TOC in a document. Use styles for your titles and headings. I do and it works fine without section breaks.
    You also need to tick which tile and heading you want in the TOCs in the Document Inspector > TOC
    Did that.
    Thanks to Yvan's quoting from the User Guide, I see where it says each TOC only indexes the material up until the next TOC. Since I had them follow each other, that is why they had no content.
    Still it defeats the objective of indexing different material throughout the document if all you get is what is between the TOCs.
    Peter

  • How to attach multiple file in one mail

    Hi,
    I've problems with sending multiple files via Gmail account (Ipad version)  When sending the photo or video, I've to just click the photo and choose send to mail one by one. Any simpler way?  Sometimes i did sent both mpg and jpg but the reciepient didn't see any attachment too
    Anyone can help advise how to attach different file (doc, video, photo) in one mail will be a lot appreciated. Thank you so much

    You can attach multiple pictures to an email on an ipad2. Don't know about original iPad.
    Choose a photo or take a screen shot (hold down home button and button next to volume control at same time--screen shot now will appear in photos).
    Go to photos and edit your picture or screen shot, save it, then hold down on the image and copy it.
    Go to mail, create a new mail and paste it in.
    Save you mail as a draft.
    Go back to photos and select a different photo, copy it, and return to your draft, and paste it in. Repeat if you need to add more.
    Anything that you can take a screen shot or have an photo of can be pasted in one at a time into that draft email.
    If mail gets uncooperative, during this process, then double click on home button and quit multitasking mail, then open up mail again and send your draft. Uncooperative means gets frozen.

  • How can I attach multiple photos to an e-mail

    I would like to attach multiple photos which are already in the photos file on my ipad to e-mails I am sending from the ipad.  Is there a place in the e-mail where you can attach photos.  The only way I have found to do it is to send from inside the photos file but can only attach one per e-mail.  Any suggestions?

    You must email the photos from within the photos app.
    You can select up to 5 photos to email at a time. While you are in thumbnail view in the photos app - tap the arrow icon in the uper right corner. Then tap on up to 5 photos in order to select them. Tap the Share button in the upper left corner and then select - email

  • Ipad 4: how do I attach multiple file types to an email?

    Hello,
    I have seen multiple threads on this topic saying you can only do attachments in an email (other than photos or videos) by going to the app that holds the file and emailing it from there (ex: go to adobe reader or ibooks to email a PDF). This work around seemed sufficient for some people but I have need to attach a JPG, PDF and .doc to a single email. How do I do this within the ipad's built in email app? Is this impossible and if so are there other free email apps that someone can reccmmend?
    I find the ability to only email files from within its parent app to be cumbersome and not in keeping with Apple's style of making one's life easier and more efficient. In fact this seems woefully backward and goes back to the early days of computing. I get it that emailing from within a particular app is necessary but so is the ability to attach multiple file types from within the email app. :-(
    So frustrated!!

    The GoodReader App can manage files and create emails consisting of multiple files types.
    See here: https://itunes.apple.com/us/app/goodreader-4/id777310222?mt=8

  • Attach multiple files to a List Item in SharePoint 2013

    Hi Guys,
    I have a customer that want to attach multiple files to single list item in a dialog box. like Datasheet View, if we set up a Datasheet View and click on the Attachment cell, it opens a dialog box that allow to select and attach multiple files as one operation. 
    Does anyone know how to solve this issue?
    As we know, if we want to attach multiple files, it only allow me to attach one file at a time, then repeat this process for every other file.
    Thanks in advance!
    Jodie

    Hi,
    According to your post, my understanding is that you wanted to upload multiple files in SharePoint list.
    There is no out of the box way to accomplish this with SharePoint.
    You can refer to the following articles to achieve it programmatically.
    Multiple Upload File Programmatically Using GridView:
    http://kamilamirul.wordpress.com/2013/01/19/multiple-upload-file-programmatically-using-gridview/
    Upload multiple files attached to a SharePoint list item.
    http://nestorrg-blogs.itequia.com/2010/01/upload-multiple-files-attached-to.html
    Programatically Upload Multiple File in SharePoint List
    http://social.technet.microsoft.com/wiki/contents/articles/2990.programatically-upload-multiple-file-in-sharepoint-list-part-2.aspx
    Programmatically uploading multiple files to Custom sharepoint list 
    http://www.c-sharpcorner.com/UploadFile/sarav82/MOSS11072007065009AM/MOSS.aspx
    Thanks & Regards,
    Jason
    Jason Guo
    TechNet Community Support

  • How to attach multiple photos in a mail?

    does anyone know how to attach multiple photos in a single email, there is no attach button...

    As far as I know, you can e-mail one picture at a time via the photo application.
    Select the picture you want and hit the icon in the lower left hand corner.
    Sorry, I know that is not what you wanted, but I don't know that there is a way to attach multiple photos.

  • Cant attach multiple files in mail

    How to attach multiple files in mail?? 

    Hey demo..
    When I create a document in 'Pages' app I can mail that file from 'Pages' app. But I cant attach multiple .doc file in one mail. For sending multiple files in a single mail I need to do several mails. Is there any system or 3rd party software through which I can attach multiple .doc files in one mail.
    Thanks in advance.

  • Unable to attach multiple files to an email in Safari using Macbook Pro 2011

    Is anyone else having this issue?  Safari won't let me select multiple files to attach to an email.  I can attach more than one file, but I have to attach them one at a time.  Is there a setting I need to change or something??

    I am having exactly the same issue as debsdesign.  The email I am using is yahoo.  I've tried both Safari and Firefox and it makes no difference.  I am using Mac OS X Lion 10.7.5.
    So to reiterate the problem - I want to attach multiple files at once to an email message I want to send.  I have tried to do the following:
    1. Select 'Attach file" in my email message
    2. In 'Finder' I have found a list of files I want to attach
    3. I can only select one file at a time and "choose" them individually - I have 16 files.  I have tried holding down the SHIFT key and selecting the last file in the list.  I have also tried holding down the COMMAND key and selecting each file in turn.  Nothing works!
    Is there a way to do this on a Mac??
    Many thanks

  • How do i attach multiple documents in email

    I am new to mac and email a ton.  I would like to attach documents to my emails, but have them as actual attachments and not part of the body of the email.  I notice there is not an option for an attachment bar.  HELP!!!

    Like you, I suffered from "paperclip withdrawal symptoms" using the iPad and iPhone Mail app to email documents. As much as I love these iDevices, I'll forever hope that Apple eventually builds the handy paperclip feature into the Mail app, which we've become so accustomed to in other email systems .
    That said, most third-party office productivity apps and some juiced-up email apps make it so simple to  attach multiple docs to an email. On an iPad, you need at least one of them to store the documents you wish to carry around with you and/or share through email. Other than GoodReader (an excellent productivity app!), there are a lot of other well-rated apps you can choose from. I've been using "Air Sharing Pro" and "Group Email with Attachments" for almost a year now -- they're almost as second nature to me now as the paperclip.
    I will soon be updating a post I wrote last year about this issue but you may still find it useful. See http://groovinonapps.com/how-to-send-multiple-attachments-on-the-iphone/. Hope this helps.

  • How do you attach multiple pictures to an email? I use yahoo, presently I copy and paste each pic separately , having to go back and forth from my pics and email. I know there's an easier way. I currently use an iPad 2 and this is my first apple product.

    I currently use an iPad 2,how does one go about attaching multiple pictures to a yahoo email? Presently I am having to copy then paste each picture
    Separately , going back and forth from my picture roll to my email. I tried to copy and paste multiple pictures but it would only paste the last picture
    I copied. I am new to apple, so any help would be appreciated .

    If you use the Mail App and configure a Yahoo account you can then select up to 5 pictures from the Photo App and mail them as a single e-mail.

  • Attach multiple movie clips

    Is it possible to do something like this:
    for(var nIndex=0; nIndex<10; nIndex++){
    this('loader'+nIndex)=new Loader();
    this('loader'+nIndex).load(url_array[nIndex]);
    addChild('loader'+nIndex);}
    i'm trying to create a loop to load multiple images.
    In the same vein how would you attach multiple movieclips in a loop like this?...
    I can do it in AS2 n=but not in AS3...
    cheers to any responders. J

    Yes it is possible to do that as long as 'this' refers to a dynamic class such as MovieClip(Sprite is not dynamic). You would also use square brackets instead of round:
    this["loader"+nIndex]
    I find it simpler to use an array to hold my loaders such as:
    var loaders:Array;
    loaders=new Array();
    for(var nIndex=0; nIndex<10; nIndex++){
        var loader:Loader=new Loader();
        loader.load(url_array[nIndex]);
        addChild(loader);
        loaders.push(loader);
    If you're publishing to Flash Player 10, you could even use a Vector instead of Array and have strong data typing.

Maybe you are looking for

  • Can't connect to new router...

    Hi I've just installed a new intranet here at my place and one of the changes is that my computer must connect to another router now. While everything works perfect in both Knoppix and windows, I can't get Arch to connect.... I've collected all files

  • Bridge web gallery issues

    Hi there, This might seem like a silly question...But I have been trying to make a web gallery in bridge to put on my Dreamweaver cs6 website. Everything is working and bridge is even saying the gallery has uploaded. But when I go back to Dreamweaver

  • How do you add a PDF to an created folder?

    I was able to add PDFs of similar topics to one folder on my iPad, now I seem to be having issues doing it, or I may have forgotten how to, but I've tried everything.... I think. Please help.

  • Refrential Integrity in BW7.0

    Hi, In BW 3.5 we have the option to check the refrential integrity in the communication structure. do we have such kind of option in BI7.0,if so could you pelase tell me where it is. points will be assigned. thanks, Subha

  • How can I find and disable Page Down in the Keyboard Shortcuts menu?

    I often accidentally hit Page Down because it's right beside my arrow keys. It seems to switch to the next symbol in the library which is something I never under any circumstances would want to do. How do I disable this incredibly annoying keyboard s