Image is not added when converting eml into htm
Hi 1 & All,
I have a problem while converting eml into htm. i.e. the image in the eml is not added to htm.
Iam using BufferedInputStream and BufferedOutputStream to read the eml body part and write into an htm.
eml body has text/html part which i wanted to create as separate html file.
The images are added in this text/html part by specifying the content-id of that image
i.e. ,
<TD width="233px"><IMG align="absbottom" src="cid:a" width="233" height="38"></td>
<TD width="100%"><IMG align="absbottom" src="cid:b" width="100%" height="38"></td>
This content-ids are defined at the bottom of the eml file.
Now, the problem is the htm file is created without adding these images and the images are created as separate pages.
Can any one Please tell me where actually iam going wrong.
Thanks & Regards,
Vjay
Re: Image is not added when converting eml into htm
Is this a Java programming problem or an HTML problem?
If you know what the correct HTML is that should be written, are you having a problem making your java program write it? If so please show the code where the problem and show what it writes that is wrong.
If you don't know what HTML should be written, try an HTML forum.
Re: Image is not added when converting eml into htm
Quote:
Originally Posted by
Norm
Is this a Java programming problem or an HTML problem?
If you know what the correct HTML is that should be written, are you having a problem making your java program write it? If so please show the code where the problem and show what it writes that is wrong.
If you don't know what HTML should be written, try an HTML forum.
--------------------------------------------------------------------------------------------
Hi Norm, Thanks for your reply.
Ya, I think its java problem, As i told iam using BufferedInputStream and BufferedOutputStream to write the htm file,
i.e.,
File partFile = new File(desFolder.getPath() + fSep + "message.htm");
BufferedOutputStream bos =null;
BufferedInputStream bis =null;
try
{
System.out.println("srcPart : "+srcPart.getContent().toString()); // to get the html content
System.out.println("srcPart.getInputStream() : "+srcPart.getInputStream().toString());
bos = new BufferedOutputStream(new FileOutputStream(partFile));
//initialize a buffered input stream for body part
bis = new BufferedInputStream(srcPart.getInputStream());
//read attachment contents into file
int dummy = -1;
while ((dummy = bis.read()) != -1)
{
bos.write(dummy);
}
done =true;
}
catch(IOException ex)
{
ex.printStackTrace();
VWLogger.error("Exception Encountered!",ex);
done = false;
}
The problem here is the eml file contains the htm part which is having
<IMG align="absbottom" src="cid:a" width="233" height="38">
The src="cid:a" i.e. the image content-id is defined at the bottom of the eml,
i.e.,
----_16sofl2.1703ip2.1pf.BODYHTMLTEXT
Content-Type: image/gif;name="gwava5.gif"
Content-Transfer-Encoding: base64
Content-ID: <a>
Content-Disposition: inline;filename="gwava5.gif"
R0lGODlh6QAmANUAAP////L69Of37+X26tjx38vs1cvs1L7nyr3nxrHjwLHjvqXetZjaq5SU
lIvVoX/QlnvWlHt7e3LMjGXHgVjDc1jCd0u9bEq9a0qtYz65YjG1UjG0V zFrOSmtSimUSila
OSEhISEYIQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAACwAAAAA6QAmAEAG
/0CQcEgsGo/IZJKjaTqf0Kh0Sq1ar9isdsvVer5gT6cJCoU45VDazBaa08w0y NPksO9397vj
YX+uEAIAg4SDAggXURCDEFYXAI1Vj5BSiwhSCIOJVYuUUQgCm1 obpAmFAAZcHh8cYh2vsLGy
sXhyHmh4amp0XU63dGVrf1Cdor1NnZFOxRoXgpdPzgDQUJnUmQ KYAKHEmoqMr5PKVqTl5gAM
5VO/s+3usm9DumYfq20f9b23H2tzdmnDunkC5K3SNmzGnggS8OwbpQ sQIyZK9u1QwScIJWpc
iOGYlVZhQoocKVLXnDW53uz6YLKNhg4o86ixFYyex5s4c+rEuS 9ChP8GQIMKHUq0aFE1/Fqm
nPfGQ0w/Gmo+zVUm4M6rWLNq3cKBVatXV1CyWqrHDBOWw+yE4MUKBL56X5 Ka7QNV20Aq0sZp
aDhFEKGEThBGkeYX8CRqUKQhXmZo2hZSDwAsGABgAAMv9d5phr eUDQcOY7Y+gRnCahNrVTKd
MgSY72GBkZhV23ZB1l7HiV3zjfZsluwq5TI4KFBggQUsXzcrhy Vzrdp+bOiwVNPEaVMNTlmB
fSk3Xt0p0gxBGA9BNe0rea1Q5I3biuqEih3qlRJf5+efRvPrDz pzphIi/iERz39GlCbagQhe
FRc+Pvm034MQHhXTVG1U2Jw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lpSjsbW8DBEiAOSqwQExF4VxBhEffqBIitJiKEyjL5CES8q swWvGJUxIEr5zgKxQGco9W
BEwNn4fADVggAAAgAA8DcClHQqEVGMilLnfJy172knClmcOB8F Sy/THMhOQZTx5X1SpUFhA3
UmSPAJJJniwx85SqBCA1xwNABI0vksy52h+yQyee8EMMYikUIb HwGm0goovJcGFrDKFJlLEm
Cs/QYr/qaU8o5gSXvgyoQHUJnYp1EHN1YEIV+EDM5tSjJktTzQFJiJdCs K4TK6xjuBxWrW5O
MWeA/CfEJkZSMGAsOs+x0O+EubshCS4eyfggWmlSlLkoGUY101SPIdz j0Vg5Ezw97Ze+OCqt
hzWgc0hNqlKXmlTeOQdIFXvXG5yAi8yR6Ed4yNwyxHWKTWYhE6 HzYvQEqFOOgjU3RLVLWK+w
M6pBSBh0OSmc2CUkDg4RQEJ7jp64sFb6rBUiB7rAAT+0iqi5lW eOw9qFKEeVLzRHsZbTauIm
65GeOOiwiK0H+mDkFqSh7xb2QolUbELZ0h5jH1GTGmbdarfWuv a1sI2tbGdL29ra9ra4za1u
d3vbBuFntasNAgA7
Now my understanding is the BufferedStreams are not identifying this cid and they are not inserting the images into htm file(rather images are considered separately and separate gif images are generated).
Can you please let me know the solution for this.
Thanks and Regards,
Vjay
Re: Image is not added when converting eml into htm
Quote:
the BufferedStreams are not identifying this cid
I'm not sure what you are saying here. Do you think the BufferedStream is supposed to look at what you write ( the cid) and change it to something else?
Won't that be the program's responsibliity, to scan through the input file byte by byte, find the cid string and replace it with something else?