0

Is any special handling required to parse the eps attachment in the eml using javamail I dont have any issue other types of attachments. only eps attachment gives problem

When i send the eps attachment using outlook 2010 it converts encoding from base64 to quoted-printable.

Below is the header of the eps attachment i am trying to parse.

Content-Type: application/postscript; name="LOGO.eps" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="LOGO.eps"

The attachment is extracted. But when i open it with document viewer it says loading forever

rebeliagamer
  • 1,257
  • 17
  • 33
amponvizhi
  • 51
  • 1
  • 3

1 Answers1

0

JavaMail tries to guess the best Content-Transfer-Encoding for the data by looking at the actual data. If JavaMail guesses that the data is text, it's likely to use quoted-printable. In some cases, the guess can be wrong, in which case you'll need to specify the encoding yourself. If you're using JavaMail 1.5, there's a new attachFile method that makes this easier.

Bill Shannon
  • 29,579
  • 6
  • 38
  • 40
  • thanks. i don't have issue in generating the attachment stream. but only in parsing it. The quoted-printable encoding is set by outlook2010. i am parsing the attachment using javamail – amponvizhi May 27 '13 at 05:45
  • Then you'll need to say more about how you're "parsing" it, and what this "document viewer" is that you're opening it with. Are you saving it to a file before you open/parse it? – Bill Shannon May 27 '13 at 16:54
  • Multipart mp= Part.getContent; MimeBodyPart mbp=Multipart.getContent(); then get the stream from mimebodypart.getInputStream() and write into a file. Read using linux document viewer – amponvizhi May 29 '13 at 11:36
  • You're probably not saving it to the file correctly. See [this JavaMail FAQ entry](http://www.oracle.com/technetwork/java/javamail/faq/index.html#readattach). – Bill Shannon May 29 '13 at 22:18