Encoding E-mail Attachments
dadams07Sep 14 2009 — edited Sep 14 2009I'm trying to understand the low-level details of encoding an e-mail attachment. Specifically, I'm calling a Web service that will send e-mails, & the service requires that I supply the e-mail parts (including attachments) as XML elements; in other words, I can't send the e-mail myself through the standard javax.mail package. In addition, my attachment will be a file whose content & type I don't know at compile time.
I've been researching attachment encoding, and have a found a dizzying (& bewildering) assortment of packages, classes, encoding options, etc. Can anyone shed light on the simplest way to encode data into a string that is acceptable in XML? If possible, I'd like to simply call some encoding method from a standard Java package (J2EE, J2SE, Jakarta Commons, etc.), but I can't figure out which of the multitude of classes is best fit.