Email Attachments Become Corrupted When Moved to a Different Mailbox

I believe that I have stumbled upon a bug in Mountain Lion mail.  Here is the set up:
Server:
Mac OS X Mountain Lion Server 10.8.2 running IMAP email service
Clients:
An assortment of Macs all running Mac OS X Mountain Lion 10.8.2 using Mail as the mail client over IMAP.
Issue:
Ever since upgrading all company Macs to Mountain Lion we have recieved complaints from people that email attachments are occationaly becoming currupted once moved to other mailboxes such as the Trash or even other IMAP folders.  The symptom has not been observed to occur with other mail services such as gMail or iCloud but rather seems to be isolated to how Mountain Lion Mail handles moved emails with attachments on an IMAP service hosted on Mountain Lion server.  The issue also seems to be related to PDF attachments only.  We could not get the issue to reoccur with say a Pages document.  The issue also does not always occur but occurs about 90% of the time. 
The email essentially goes from looking normal in the inbox to containing this text in it after it has been moved to another mailbox (obviously the real thing is like a hundred pages long):
--Apple-Mail=_6C0E1272-08D2-7895-83FF-2F03EF82B31D
Content-Disposition: inline;
          filename="example.pdf"
Content-Type: application/pdf;
          x-unix-mode=0644;
          name="example.pdf"
Content-Transfer-Encoding: base64
JVBERi0xLjMKJcTl8uXrp/Og0MTGCjQgMCBvYmoKPDwgL0xlbmd0aCA1IDAgUiAvRmlsdGVyIC9G
bGF0ZURlY29kZSA+PgpzdHJlYW0KeAF1UttOwzAMfc9XnMcEaWmctkkr8cJlEncVCEjcHtAYEgjY
mOCBv8dJ13YMUFXFso+P7WO/4xTvyJrpYjKdf3zev2DxxA5nKhj+bNW+k1dk+6+E3Rnjc4QFtgMo
Ikx8qIT1uQiMCoE0OxAecQPZKIwslTq
Now if that same email, now moved into a new mailbox, apearing corupted to the Mac Mail client, is viewed from say an iPhone or iPad, the attachment appears normal.  If a new Mac client is set up to read that email account that email also appears normal.  This would indicate that issue does not seem to be occuring server side but however seems related to a cashe issue with the Mail client. 
Temporary Fix:
Now this is not a good fix but deleting the entire /User/Library/Mail folder and forcing Mail to completely reconnect to the IMAP server and redownload all headers and attachements fixes the issue.  However this only fixes the emails that once appeard corrupted to the client.  Any new emails moved around will continue to get corupted.  Syncronizing the mailbox does nothing to rectify the issue.
Plee for help:
Obviosuly this is a serious issue and must be rectified.  We are using the most standard and Mac friendly/default set up possible (even a Mac server).  Has anyone expereinced this issue or want to venture a guess on how to fix it?  Does it seem like a bug in the Mail client to you?  Any ideas???
I really apprecaite the help.
-Christian

Oh man! So they say "We know this is a bug and we can't fix it since Tiger" ????? This is Apple with an army of developers and they can't fix this annoying issue???? WHAT???? I think this is a not a day more problem to fix and their professional OS X Server is affected by this problem as well and they don't fix it... their own software... what a customer care!!!
Anyway it sounds ******** and the solution is the same category... if you have only one mail in the mailbox and move to an other on a certain type of server it's getting corrupted, but the rebuild process works and when you move back it will be corrupted again! They should fix this but it looks like they will never fix it... it's a shame from a big company which sells premium products.
So if you still in contact with an Apple technician and they're opened I can provide both of the server platform when the problem can be proofed. (one where the sync is ok and one where it isn't and only with one mail in it ) Please contact me and I can help!
You can try other mail softwares and they can handle the imap protocol without major problems. I tried the following ones:
- Postbox
- Thunderbird
- Sparrow
- Mail Mate
Both works very wall but any of them is so integrated as the mail app with osx. Unfortunately if you live in the apple ecosystem and own more than one mac computer you will stuck with the apple one with all of its bugs.
...since Tiger... I can't get over it...
Sorry guys I getting angry when I hear this kind of stories...

Similar Messages

  • [svn:fx-4.0.0] 13615: fix airframework/build. xml so the en_US _rb does not become corrupt when the other. locales target is run.

    Revision: 13615
    Revision: 13615
    Author:   [email protected]
    Date:     2010-01-18 20:59:14 -0800 (Mon, 18 Jan 2010)
    Log Message:
    fix airframework/build.xml so the en_US _rb does not become corrupt when the other.locales target is run.
    -removed the redundant en_US call in the other.locales target
    -added a clean for locales that will only remove the locale being built before rebuild - not all of the locales
    -add updated dita that does not contain spark references
    QE notes: 
    Doc notes:
    Bugs: no but Pete and I discussed briefly
    Reviewer:
    Tests run: doc and other.locales
    Is noteworthy for integration:
    Modified Paths:
        flex/sdk/branches/4.0.0/frameworks/projects/airframework/build.xml
        flex/sdk/branches/4.0.0/frameworks/projects/airframework/bundles/de_DE/docs/packages.dita
        flex/sdk/branches/4.0.0/frameworks/projects/airframework/bundles/fr_FR/docs/packages.dita
        flex/sdk/branches/4.0.0/frameworks/projects/airframework/bundles/ru_RU/docs/packages.dita
        flex/sdk/branches/4.0.0/frameworks/projects/airframework/bundles/zh_CN/docs/packages.dita

    What kind of projects are they (Struts/JSF/Hibernate)? Does the working project differ in any way with other two apps?
    What exactly is not working? Are they recognized by workshop as Struts/JSF/Hibernate app?
    Please send the .log to [email protected]

  • Using Lightroom 5.7, Raw files become from my Nikon D810 become corrupted when I select them to view or edit.

    .Updated to Lightroom 5.7 to accommodate the Nikon D810. Upon importing RAW files to the files become corrupted when they are selected to be viewed or edited.
    I am using Windows 7, 64 bit, with 8 GB Ram.
    Any help would be appreciated.

    There are several likely sources of corruption, and video card would be far down on my list of possible suspects.
    The transfer from camera card to hard disk is the most likely place for problem, either the card reader or USB cable can go bad. Another likely source of problems is the computer's hard disk is starting to fail. The camera card itself may be bad. And lastly, the memory in the computer may be malfunctioning.

  • Why does the Yosemite Finder become unresponsive when moving a file within my USB Flash stick?

    Why does the Yosemite Finder become unresponsive when moving a file within my USB Flash stick? I have to Relaunch the Finder to get it working again.
    Background / other symptoms:
    The Flash drive in question has been formatted HFS.
    I get no error messages, including on the Console, and no sound indicators.
    I can copy files, using the Finder, from a hard-drive to the usb flash drive with no problem.
    Finder copying on this stick works just fine on my other Mac.
    I can move files within another (FAT32-formatted) USB flash drive.
    The quirky USB HFS Flash drive works fine on my other Mac.
    Outside of the Finder, I can use mv just fine to move the files on the HFS flash drive.
    If the HFS-formatted Flash drive were faulty, I would at least expect some sort of error in the Console app, but perhaps not from the Finder.

    Why does the Yosemite Finder become unresponsive when moving a file within my USB Flash stick? I have to Relaunch the Finder to get it working again.
    Background / other symptoms:
    The Flash drive in question has been formatted HFS.
    I get no error messages, including on the Console, and no sound indicators.
    I can copy files, using the Finder, from a hard-drive to the usb flash drive with no problem.
    Finder copying on this stick works just fine on my other Mac.
    I can move files within another (FAT32-formatted) USB flash drive.
    The quirky USB HFS Flash drive works fine on my other Mac.
    Outside of the Finder, I can use mv just fine to move the files on the HFS flash drive.
    If the HFS-formatted Flash drive were faulty, I would at least expect some sort of error in the Console app, but perhaps not from the Finder.

  • Error message when moving to a different page

    Post Author: EvDev
    CA Forum: .NET
    I have an ASP.NET 2.0 and Crystal Reports 11.5 project that works fine
    when it's being debugged and when it's on our test server, but when we move it
    to our production server the user will receive an error message when moving to a
    different page of the report.  It's an
    "Object reference not set to an instance of an object".  It seems very
    odd for me for something to work on the test server but not on production.   Has
    anyone seen this before?  Thanks

    Hi there,
    This does seem like a very valid process to be sure
    I'm guessing that the fix is shown in "Solution 1" in this doc;
    http://www.cisco.com/en/US/partner/products/sw/voicesw/ps556/products_tech_note09186a0080b04158.shtml
    Cheers!
    Rob

  • Video files seem to become corrupted when I adjust speed

    Hello,
    I have started editing a new project, and am experiencing a familiar problem that I have encountered in the past, but which was never really resolved. I'm not very technical, so apologies if my description of the problem is simplstic.
    The problem is that after making certain edits in the Project window, I find that the entire project has some how become corrupted: i.e. every single clip becomes impossible to edit - I can't spool through the clips and view them in the screen by dragging my mouse cursor over them, and I can't even delete the clip whose edit seemed to result in the corruption.
    If I leave the project to go back to the project library, it is now impossible to re-enter the project. The words "edit project" in the button at the top left become grey. I find that the most common cause for this problem is whenever I attempt to adjust the speed of a clip, or reverse it. Is this a common problem with a simple solution?
    I have come up with a makeshift solution, which is far from satisfactory, but does sometimes help: I remove the file in the iMovie Events folder in Finder that contains the clips that I can no longer edit, and open up iMovie. The event library in iMovie will now be empty; I replace the events files back into the iMovie Events folder in Finder, then import a random clip into iMovie. The random clip is imported into a seprate event of its own, and the original file that I had put back into iMovie Events reappears simultaneously. Sometimes when I do this, the clips in the Project library are editable again, but not always.
    However, I would far rather that the programme simply processed my edits without corrupting the project. Is anyone familliar with this problem, and does anyone have a solution. Thank you very much in advance.

    There are several likely sources of corruption, and video card would be far down on my list of possible suspects.
    The transfer from camera card to hard disk is the most likely place for problem, either the card reader or USB cable can go bad. Another likely source of problems is the computer's hard disk is starting to fail. The camera card itself may be bad. And lastly, the memory in the computer may be malfunctioning.

  • Problems when moving projects to different workstation.

    hi everyone,
    Im done making an application and when i moved to a different workstation, something went wrong.. i created a JPanel + database driven components, i added it to the pallete using pallete manager. every is ok until when i changed my computer, a warning message appear when i view it in design view... "WARNING: Form loaded with errors." The thing is i compiled it and nothing is wrong. the project still runs but a NoClassDefFound error occur... im using same versions of netbeans 5.5 and jdk1.6....
    am i doing the transfering of the project folder right or is on adding the jpanels to the pallete window. Or is it something else...
    im learning java but had confusions in netbeans.
    thanks...
    ieMoon

    Oops... sorry for posting in the wrong forum... thanks anyway... the problem is i missed that my app requires the GroupLayout manager classes, and was not include in the jar... anyway, sorry...
    :)

  • Attachments to emails become corrupted when sent from Q10

    I can receive an email from work with an attachment and open it fine, but if I forward it, although the email goes fine, when the attachment is opened it is blank, and there is a message stating that the pdf is corrupt. I have updated to the latest versions of Blackberry software and Adobe Reader software.
    This was not a problem on any of my previous Blackberry phones which were Curves and Bolds.
    Billy

    Hey billstup,
    Welcome to the BlackBerry Support Community Forums.
    Thanks for the question.
    If you download and save the attachment onto your BlackBerry Q10 and then forward the email with that saved attachment, does it still show up as corrupt?
    Also what type of email account is added (POP3, IMAP, Exchange?)
    I look forward to your reply.
    Cheers.
    -ViciousFerret
    Come follow your BlackBerry Technical Team on Twitter! @BlackBerryHelp
    Be sure to click Like! for those who have helped you.
    Click  Accept as Solution for posts that have solved your issue(s)!

  • Zip attachments are unusable when moving an email message

    I'm asking this question on behalf of a coworker. Here's the scenario.
    Each month we receive a .zip file from one of our vendors. My coworker receives that file, and if she moves the message from her inbox to a different folder (in Apple Mail) the .zip file becomes unusable ... it's displayed as garbled text/code.
    If she doesn't move that .zip file it's perfectly normal and usable, but as soon as it moves it's zapped.
    Any ideas on what's causing this, and how to fix it?

    The garbled text is displaying in the mail message (after it's moved). Here's a partial screen shot:
    The extra quote level was added when she forwarded the message to me.
    Normally she's able to use the attached ZIP file, but as part of her workflow she moves her emails to different folders depending on what she needs to do next. That works for everything except this email with the ZIP file. She'll move the email, but then the ZIP turns into what I showed in the screen shot. When it gets to this point there's nothing to unzip.
    As long as she remembers to NOT move this email (and grab the attachment right away) everything is fine. But if she moves the message, then the bad stuff happens.

  • Some PDF attachments are corrupted when emailed using javamail

    I have a java class that takes a file name, 'To' email, and 'From' email as parameters, and then emails the named file to the specified address as a Multipart email.
    The problem that I am facing is that sometimes the PDF cannot be opened when it arrives because it is corrupt. I know that prior to sending, the PDF opens without issue, so the problem is in the code somewhere.
    There are a couple of oddities here:
    1) PDFs that get corrupted and PDFs that do not get corrupted are generated from the same source (Oracle Report), so I believe that rules out a problem with malformed emails?
    2) If I compare the PDF before it gets sent to the PDF that arrives in my inbox using a hex editor (XVI32), the files are identical except that an extra character is getting added to the corrupt PDFs at the end of each line - hex '0A', which corresponds to ASCII linefeed. This indicates to me that maybe there is a problem with the way that the file is getting encoded when it is read. If I remove all of the 0A characters, the file opens correctly.
    I believe that the code I am using is set up correctly, as I have looked at countless examples of this online to try to find my problem. Hopefully someone can point me in the right direction. Code is included below.
    Thanks,
    Nick
    import java.util.*;
    import javax.activation.DataHandler;
    import javax.activation.FileDataSource;
    import javax.mail.*;
    import javax.mail.internet.*;
    public class test {
        public static void main(String args[]) {
            System.out.println("entered TEST email class");
            if (args.length < 3) {
                System.out.println("Invalid number of arguments. Syntax is 'java test <fileName> <fromEmail> <toEmail>'");
            } else {
                System.out.println("Correct number of arguments.");
                send(args[0], args[1], args[2]);
        public static void send(String fileName, String fromEmail, String toEmail) {
            System.out.println("Made it to SEND method");
            try {
                Properties props = new Properties();
                props.put("mail.smtp.host", "email.host");
                Session session = Session.getDefaultInstance(props, null);
                MimeMessage msg = new MimeMessage(session);
                //set from/to email addresses
                System.out.println("Setting email addresses...");
                msg.setFrom(new InternetAddress(fromEmail));
                msg.setRecipients(javax.mail.Message.RecipientType.TO, toEmail);
                //set email subject
                System.out.println("Setting subject...");
                msg.setSubject("email from TEST class");
                //define a body part for the email text and add text to it
                System.out.println("Setting body...");
                MimeBodyPart messageBodyPart = new MimeBodyPart();
                messageBodyPart.setContent("This is the email body. Here is some more body.", "text/html");
                //add code for attachment here!!
                System.out.println("Setting attachment...");
                MimeBodyPart attachFilePart = new MimeBodyPart();
                FileDataSource fds =
                        new FileDataSource(fileName);
                attachFilePart.setDataHandler(new DataHandler(fds));
                attachFilePart.setFileName(fds.getName());
                //define a multipart, and add the text body part and the attachment body part to it
                System.out.println("Building message...");
                Multipart mp = new MimeMultipart();
                mp.addBodyPart(messageBodyPart);
                mp.addBodyPart(attachFilePart);
                //add the multipart to the message
                msg.setContent(mp);
                //send the email
                System.out.println("Sending message...");
                Transport.send(msg);
                System.out.println("Email has been sent!");
            } catch (Exception e) {
                System.out.println("Error in test.send method: " + e.getMessage());
    }Edited by: nbacon on Sep 2, 2010 12:12 PM

    Normally pdf files are text, with any binary data represented as encoded text. If your pdf files
    include raw binary data, JavaMail can be confused. JavaMail will try to guess what encoding
    is appropriate for your data. If the data is mostly text, JavaMail will use quoted-printable encoding,
    and will canonicalize the text lines to end with CRLF (0x0D, 0x0A). A 0x0D in the binary will look
    like an end of line and will turn into 0x0D, 0x0A.
    You can force JavaMail to use base64 encoding for your data, which will preserve the binary
    data exactly, by using
    attachFilePart.setHeader("Content-Transfer-Encoding", "base64");
    after setting the content for the part.
    Alternatively, you could figure out how to generate pdf files that don't include raw binary data.

  • File extensions become corrupted when sending attachments in Mail

    Hi,
    Since I upgraded to Leopard the file extensions on attachments that I send in Mail are corrupted in transit. The problem is not irremediable: .doc may change to .doc00 or .docis or something like that. The recipient can delete the extra characters when saving or opening the attachment, and the file is intact. But this is a bit of a bore, as I have to send attachments all the time. It doesn't matter whether I send from my iMac G5 or my MacBookPro, and it doesn't matter whether the recipient has a Mac or a PC.
    Any collective wisdom out there?
    Many thanks,
    Anna

    Some people have found that not having accented characters or spaces in the file name cures it. The bug has been reported.
    AK

  • Email attachments sometimes disappear when sending to a PC user

    When I send an email with an attachment (normally a PDF or JPG), in of course an exceptable size, to a PC user, the attachment will disappear for them. When they receive and open the email, only a small gray outlined box appears for them, with an "X" through it. This does not always happen for me, only for certain PC users. I have a feeling ti may be a setting error on their end, but I need to make sure. I would love to have a fix for the issue or else a solution to tell the client to try. Thanks.

    Oh man! So they say "We know this is a bug and we can't fix it since Tiger" ????? This is Apple with an army of developers and they can't fix this annoying issue???? WHAT???? I think this is a not a day more problem to fix and their professional OS X Server is affected by this problem as well and they don't fix it... their own software... what a customer care!!!
    Anyway it sounds ******** and the solution is the same category... if you have only one mail in the mailbox and move to an other on a certain type of server it's getting corrupted, but the rebuild process works and when you move back it will be corrupted again! They should fix this but it looks like they will never fix it... it's a shame from a big company which sells premium products.
    So if you still in contact with an Apple technician and they're opened I can provide both of the server platform when the problem can be proofed. (one where the sync is ok and one where it isn't and only with one mail in it ) Please contact me and I can help!
    You can try other mail softwares and they can handle the imap protocol without major problems. I tried the following ones:
    - Postbox
    - Thunderbird
    - Sparrow
    - Mail Mate
    Both works very wall but any of them is so integrated as the mail app with osx. Unfortunately if you live in the apple ecosystem and own more than one mac computer you will stuck with the apple one with all of its bugs.
    ...since Tiger... I can't get over it...
    Sorry guys I getting angry when I hear this kind of stories...

  • Word email attachments get corrupted from desktop to laptop

    I've been sending Microsoft Word attachments via email from my iMac (mid-2007 Intel running Yosemite) to my laptop (Macbook Pro running Mavericks). The downloads always come through as corrupt, though the original files are fine. (If I put them on a flash drive, I can open them on the Macbook.) The Macbook connects via wifi while the iMac is plugged in to a router and modem, in case that has anything to do with it. Any ideas?
    Thanks very much --
    Christine

    I should add that Word documents I send from the laptop to iMac come through fine.

  • Catalog corruption when moving files in folder view

    LR 1.3.1 MacOS 10.5 (although also happened with 10.4)
    I've been using LR since the free beta and have over 6,000 images in my catalog. I shoot Nikon cameras almost always in RAW + JPEG. I used to add the jpegs as separate images, but now use them as my previews.
    I recently became low on space on my system hard drive and attached an external FW 800 500GB disk that I decided to store my photos on. Using LR, using the folder view, I moved my images from the hard drive onto the external FW disk. Now, all the NEF's that I imported as NEF+JPEG are "corrupted". Specifically, when I look at them in Grid view, the thumbnails look "OK", however underneath the file name (eg: _DSCXXXX) it now says "JPG+JPEG" instead of "NEF+JPEG". When I go into Edit mode to look at the preview though, the initial image looks "normal" however I get a message saying "Rendering: Settings changed ..." and then the image looks ..... weird, perhaps cross processed or something, and then going back to Grid mode the thumbnail is now changed. If I say to show the file in Finder, it shows me the JPG file, not the NEF file. It's like the NEF file has disappeared. All the NEF's that I loaded without the accompanying JPEG are fine.
    I had the same problem over 1 year ago and we filed a bug against LR but never heard anything back. I'm hoping that someone else has encountered this problem and can suggest how to fix the corrupted database. Otherwise, I will have to revert to a backup catalog and try "re-finding" the files on the new FW drive.
    Thanks,
    Janice

    I'm simply using the JPEG's as previews so there is no separate "file" in LR for them so I can't delete them from LR. I suppose I could delete all the files out of the catalog and reimport them .... that sounds fun ... since they are keyworded and some are modified it makes more sense to revert to a backup and hope I can refind them. Perhaps deleting the ... Previews.lrdata file (not folder) might do it as you suggest but I'm a bit reticent just yet.
    I don't want to take this thread off topic, but will have to look around a bit to find out why someone would not want to have both as "originals" as you indicate.
    Thanks for taking the time to suggest,
    Janice

  • Email attachments gets corrupted (javamail)

    hi i am using javamail1.4
    when i am trying to store the attachmnets in a folder they are getting corrupted.
    please help me in this

    some code plz.
    anyway, here a typical code to send e-mails (with or without attachementpackage test;
    import java.io.File;
    import java.util.Date;
    import java.util.Properties;
    import javax.activation.DataHandler;
    import javax.activation.FileDataSource;
    import javax.mail.Message;
    import javax.mail.MessagingException;
    import javax.mail.Multipart;
    import javax.mail.Session;
    import javax.mail.Transport;
    import javax.mail.internet.InternetAddress;
    import javax.mail.internet.MimeBodyPart;
    import javax.mail.internet.MimeMessage;
    import javax.mail.internet.MimeMultipart;
    public class SendMail {
         // Sender, Recipient, CCRecipient, and BccRecipient are comma-separated
         // lists of addresses. Body can span multiple CR/LF-separated lines.
         // Attachments is a ///-separated list of file names.
         public static int Send(String SMTPServer, String SMTPPort, String Sender, String Recipient, String CcRecipient, String BccRecipient,
                   String Subject, String Body, String ErrorMessage[], String Attachments, String encoding) {
              // Error status;
              int ErrorStatus = 0;
              // Create some properties and get the default Session;
              Properties props = System.getProperties();
              props.put("mail.smtp.host", SMTPServer);
              props.put("mail.smtp.port", SMTPPort);
              props.put("mail.mime.charset", encoding);
              Session session = Session.getDefaultInstance(props, null);
              try {
                   // Create a message.
                   MimeMessage msg = new MimeMessage(session);
                   // extracts the senders and adds them to the message.
                   // Sender is a comma-separated list of e-mail addresses as per RFC822.
                        InternetAddress[] TheAddresses = InternetAddress.parse(Sender);
                        msg.addFrom(TheAddresses);
                   // Extract the recipients and assign them to the message.
                   // Recipient is a comma-separated list of e-mail addresses as per RFC822.
                        InternetAddress[] TheAddresses = InternetAddress.parse(Recipient);
                        msg.addRecipients(Message.RecipientType.TO, TheAddresses);
                   // Extract the Cc-recipients and assign them to the message;
                   // CcRecipient is a comma-separated list of e-mail addresses as per RFC822
                   if (null != CcRecipient) {
                        InternetAddress[] TheAddresses = InternetAddress.parse(CcRecipient);
                        msg.addRecipients(Message.RecipientType.CC, TheAddresses);
                   // Extract the Bcc-recipients and assign them to the message;
                   // BccRecipient is a comma-separated list of e-mail addresses as per RFC822
                   if (null != BccRecipient) {
                        InternetAddress[] TheAddresses = InternetAddress.parse(BccRecipient);
                        msg.addRecipients(Message.RecipientType.BCC, TheAddresses);
                   // Subject field
                   msg.setSubject(Subject);
                   // Create the Multipart to be added the parts to
                   Multipart mp = new MimeMultipart();
                   // Create and fill the first message part
                        MimeBodyPart mbp = new MimeBodyPart();
                        mbp.setText(Body);
                        // Attach the part to the multipart;
                        mp.addBodyPart(mbp);
                   // Attach the files to the message
                   if (null != Attachments) {
                        File file;
                        int StartIndex = 0, PosIndex = 0;
                        while (-1 != (PosIndex = Attachments.indexOf(",", StartIndex))) {
                             file = new File(Attachments.substring(StartIndex, PosIndex));
                             if (file.exists()) {
                                  // Create and fill other message parts;
                                  MimeBodyPart mbp = new MimeBodyPart();
                                  FileDataSource fds = new FileDataSource(Attachments.substring(StartIndex, PosIndex));
                                  mbp.setDataHandler(new DataHandler(fds));
                                  mbp.setFileName(fds.getName());
                                  mp.addBodyPart(mbp);
                             PosIndex += 3;
                             StartIndex = PosIndex;
                        // Last, or only, attachment file;
                        if (StartIndex < Attachments.length()) {
                             String filePath = Attachments.substring(StartIndex).trim();
                             file = new File(filePath);
                             if (file.exists()) {
                                  MimeBodyPart mbp = new MimeBodyPart();
                                  FileDataSource fds = new FileDataSource(filePath);
                                  mbp.setDataHandler(new DataHandler(fds));
                                  mbp.setFileName(fds.getName());
                                  mp.addBodyPart(mbp);
                   // Add the Multipart to the message
                   msg.setContent(mp);
                   // Set the Date: header
                   msg.setSentDate(new Date());
                   // Send the message;
                   Transport.send(msg);
              } catch (MessagingException e) {
                   ErrorMessage[0] = e.toString();
                   Exception TheException = null;
                   if ((TheException = e.getNextException()) != null)
                        ErrorMessage[0] = ErrorMessage[0] + "\n" + TheException.toString();
                   ErrorStatus = 1;
              return ErrorStatus;
         } // End Send Class
         public static void main(String[] args) {
              String SMTPServer="";
              String SMTPPort="25";
              String Sender="";
              String Recipient="";
              //String Recipient="";
              String CcRecipient="";
              String BccRecipient="";
              String Subject="";
              String Body="";
              //String Body="";
              String[] ErrorMessage=new String[]{""};
              String Attachments="a.pdf, b.doc";
              String Encoding="ISO-8859-1";
              SendMail.Send(SMTPServer, SMTPPort, Sender, Recipient, CcRecipient, BccRecipient, Subject, Body, ErrorMessage, Attachments, Encoding);
    } // End of public class SendMail):
    You'll need at least activation.jar and mail.jar

Maybe you are looking for